import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { InvoiceInfoVO, InvoiceInfoForm, InvoiceInfoQuery } from '@/api/customer/customerFile/invoiceInfo/types';

/**
 * 查询客户开票信息列表
 * @param query
 * @returns {*}
 */

export const listInvoiceInfo = (query?: InvoiceInfoQuery): AxiosPromise<InvoiceInfoVO[]> => {
  return request({
    url: '/customer/invoiceInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询客户开票信息详细
 * @param id
 */
export const getInvoiceInfo = (id: string | number): AxiosPromise<InvoiceInfoVO> => {
  return request({
    url: '/customer/invoiceInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增客户开票信息
 * @param data
 */
export const addInvoiceInfo = (data: InvoiceInfoForm) => {
  return request({
    url: '/customer/invoiceInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改客户开票信息
 * @param data
 */
export const updateInvoiceInfo = (data: InvoiceInfoForm) => {
  return request({
    url: '/customer/invoiceInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除客户开票信息
 * @param id
 */
export const delInvoiceInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/customer/invoiceInfo/' + id,
    method: 'delete'
  });
};
