import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { InvoiceQuery, InvoiceVO, InvoiceForm } from './types';

export function listInvoice(query: InvoiceQuery): AxiosPromise<InvoiceVO[]> {
  return request({ url: '/edu/invoice/list', method: 'get', params: query });
}

export function getInvoice(id: number | string): AxiosPromise<InvoiceVO> {
  return request({ url: '/edu/invoice/' + id, method: 'get' });
}

export function addInvoice(data: InvoiceForm) {
  return request({ url: '/edu/invoice', method: 'post', data });
}

export function updateInvoice(data: InvoiceForm) {
  return request({ url: '/edu/invoice', method: 'put', data });
}

export function delInvoice(ids: string | number | (string | number)[]) {
  return request({ url: '/edu/invoice/' + ids, method: 'delete' });
}
