import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ContractChangePaymentMethodVO, ContractChangePaymentMethodForm, ContractChangePaymentMethodQuery } from '@/api/oa/erp/contractChangePaymentMethod/types';

/**
 * 查询合同变更付款方式列表
 * @param query
 * @returns {*}
 */

export const listContractChangePaymentMethod = (query?: ContractChangePaymentMethodQuery): AxiosPromise<ContractChangePaymentMethodVO[]> => {
  return request({
    url: '/oa/erp/contractChangePaymentMethod/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询合同变更付款方式详细
 * @param changePaymentId
 */
export const getContractChangePaymentMethod = (changePaymentId: string | number): AxiosPromise<ContractChangePaymentMethodVO> => {
  return request({
    url: '/oa/erp/contractChangePaymentMethod/' + changePaymentId,
    method: 'get'
  });
};

/**
 * 新增合同变更付款方式
 * @param data
 */
export const addContractChangePaymentMethod = (data: ContractChangePaymentMethodForm) => {
  return request({
    url: '/oa/erp/contractChangePaymentMethod',
    method: 'post',
    data: data
  });
};

/**
 * 修改合同变更付款方式
 * @param data
 */
export const updateContractChangePaymentMethod = (data: ContractChangePaymentMethodForm) => {
  return request({
    url: '/oa/erp/contractChangePaymentMethod',
    method: 'put',
    data: data
  });
};

/**
 * 删除合同变更付款方式
 * @param changePaymentId
 */
export const delContractChangePaymentMethod = (changePaymentId: string | number | Array<string | number>) => {
  return request({
    url: '/oa/erp/contractChangePaymentMethod/' + changePaymentId,
    method: 'delete'
  });
};

/**
 * 下拉框查询合同变更付款方式列表
 * @param query
 * @returns {*}
 */
export function getErpContractChangePaymentMethodList (query) {
    return request({
        url: '/oa/erp/contractChangePaymentMethod/getErpContractChangePaymentMethodList',
        method: 'get',
        params: query
    });
};
