import { requestClient } from '#/api/request';

export namespace CrmSaleQuotationAiApi {
  /** OCR 识别后的报价物料明细 */
  export interface OcrItemVO {
    itemName?: string;
    itemSpec?: string;
    count?: number;
    quotationPrice?: number;
  }

  /** AI OCR 识别报价文件响应 */
  export interface OcrResultVO {
    name?: string;
    customerName?: string;
    quotationTime?: string;
    validUntil?: string;
    taxRate?: number;
    discountPercent?: number;
    remark?: string;
    items?: OcrItemVO[];
    rawText?: string;
  }
}

/** AI OCR 识别报价文件 */
export function ocrSaleQuotation(blobId: number) {
  return requestClient.post<CrmSaleQuotationAiApi.OcrResultVO>(
    '/crm/sale-quotation/ai/ocr',
    { blobId },
  );
}
