import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { StatementProductVO, StatementProductForm, StatementProductQuery } from '@/api/bill/statementProduct/types';

/**
 * 查询对账单商品明细列表
 * @param query
 * @returns {*}
 */

export const listStatementProduct = (query?: StatementProductQuery): AxiosPromise<StatementProductVO[]> => {
  return request({
    url: '/bill/statementProduct/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询对账单商品明细详细
 * @param id
 */
export const getStatementProduct = (id: string | number): AxiosPromise<StatementProductVO> => {
  return request({
    url: '/bill/statementProduct/' + id,
    method: 'get'
  });
};

/**
 * 新增对账单商品明细
 * @param data
 */
export const addStatementProduct = (data: StatementProductForm) => {
  return request({
    url: '/bill/statementProduct',
    method: 'post',
    data: data
  });
};

/**
 * 修改对账单商品明细
 * @param data
 */
export const updateStatementProduct = (data: StatementProductForm) => {
  return request({
    url: '/bill/statementProduct',
    method: 'put',
    data: data
  });
};

/**
 * 删除对账单商品明细
 * @param id
 */
export const delStatementProduct = (id: string | number | Array<string | number>) => {
  return request({
    url: '/bill/statementProduct/' + id,
    method: 'delete'
  });
};
