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

/**
 * 查询发票信息列表
 * @param query
 * @returns {*}
 */

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

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

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

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

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