import { z } from 'zod'; export const invoiceLineItemSchema = z.object({ productName: z.string(), quantity: z.number(), unitPrice: z.number().optional(), totalAmount: z.number().optional(), barcode: z.string().optional(), /** Matched ShopProduct id when OCR name matches. */ productId: z.string().uuid().optional(), /** Per-item confidence 0–1 for manual verification (Gap 9). */ confidence: z.number().min(0).max(1).optional(), }); export const analyzeInvoiceResponseSchema = z.object({ items: z.array(invoiceLineItemSchema), supplierName: z.string().optional(), totalAmount: z.number().optional(), confidence: z.number().min(0).max(1).optional(), }); export const confirmRestockSchema = z.object({ items: z.array( z.object({ productId: z.string().uuid().optional(), productName: z.string(), quantity: z.number(), unitPrice: z.number().optional(), }), ), supplierName: z.string().optional(), totalAmount: z.number().optional(), }); export type InvoiceLineItem = z.infer; export type AnalyzeInvoiceResponse = z.infer; export type ConfirmRestockInput = z.infer;