import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { QuotationVO, QuotationForm } from './types';

/** 查询报价单列表 */
export function listQuotation(query: any): AxiosPromise<QuotationVO[]> {
    return request({
        url: '/customer/quotation/list',
        method: 'get',
        params: query
    });
}

/** 获取报价单详细并包含清单项 */
export function getQuotation(id: string | number): AxiosPromise<QuotationVO> {
    return request({
        url: `/customer/quotation/${id}`,
        method: 'get'
    });
}

/** 新增报价单 */
export function addQuotation(data: QuotationForm): AxiosPromise<void> {
    return request({
        url: '/customer/quotation',
        method: 'post',
        data: data
    });
}

/** 修改报价单 (覆盖清单) */
export function updateQuotation(data: QuotationForm): AxiosPromise<void> {
    return request({
        url: '/customer/quotation',
        method: 'put',
        data: data
    });
}

/** 删除报价单 */
export function delQuotation(id: string | number | (string | number)[]): AxiosPromise<void> {
    return request({
        url: `/customer/quotation/${id}`,
        method: 'delete'
    });
}
