import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { StatementInvoiceDetailVO, StatementInvoiceDetailForm, StatementInvoiceDetailQuery } from '@/api/bill/statementInvoiceDetail/types';

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

export const listStatementInvoiceDetail = (query?: StatementInvoiceDetailQuery): AxiosPromise<StatementInvoiceDetailVO[]> => {
  return request({
    url: '/bill/statementInvoiceDetail/list',
    method: 'get',
    params: query
  });
};

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

/**
 * 新增销售发票明细
 * @param data
 */
export const addStatementInvoiceDetail = (data: StatementInvoiceDetailForm) => {
  return request({
    url: '/bill/statementInvoiceDetail',
    method: 'post',
    data: data
  });
};

/**
 * 修改销售发票明细
 * @param data
 */
export const updateStatementInvoiceDetail = (data: StatementInvoiceDetailForm) => {
  return request({
    url: '/bill/statementInvoiceDetail',
    method: 'put',
    data: data
  });
};

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