import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { StatementInvoiceProductVO, StatementInvoiceProductForm, StatementInvoiceProductQuery } from '@/api/bill/statementInvoiceProduct/types';

/**
 * 查询销售发票商品列表
 * @param query
 * @returns {*}
 */

export const listStatementInvoiceProduct = (query?: StatementInvoiceProductQuery): AxiosPromise<StatementInvoiceProductVO[]> => {
  return request({
    url: '/bill/statementInvoiceProduct/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询销售发票商品详细
 * @param id
 */
export const getStatementInvoiceProduct = (id: string | number): AxiosPromise<StatementInvoiceProductVO> => {
  return request({
    url: '/bill/statementInvoiceProduct/' + id,
    method: 'get'
  });
};

/**
 * 新增销售发票商品
 * @param data
 */
export const addStatementInvoiceProduct = (data: StatementInvoiceProductForm) => {
  return request({
    url: '/bill/statementInvoiceProduct',
    method: 'post',
    data: data
  });
};

/**
 * 修改销售发票商品
 * @param data
 */
export const updateStatementInvoiceProduct = (data: StatementInvoiceProductForm) => {
  return request({
    url: '/bill/statementInvoiceProduct',
    method: 'put',
    data: data
  });
};

/**
 * 删除销售发票商品
 * @param id
 */
export const delStatementInvoiceProduct = (id: string | number | Array<string | number>) => {
  return request({
    url: '/bill/statementInvoiceProduct/' + id,
    method: 'delete'
  });
};
