import type { UploadEntry, UploadKind, UploadAcceptance } from "./types"; // --------------------------------------------------------------------------- // Upload acceptance rules — kept populated so the UI on /dashboard/uploads // can still render its format / size hints and the /api/upload endpoint // can still validate incoming files. Once PocketBase is wired, the // history below will be replaced with live queries to the appropriate // PB collection per kind. // --------------------------------------------------------------------------- export const UPLOAD_ACCEPTANCE: Record = { orders: { mimes: ["text/csv", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"], extensions: [".csv", ".xls", ".xlsx"], maxBytes: 10 * 1024 * 1024, // 10 MB description: "Bulk purchase order lines, supplier invoices, or stock-sheet exports.", }, "delivery-notes": { mimes: ["application/pdf", "image/png", "image/jpeg", "image/webp"], extensions: [".pdf", ".png", ".jpg", ".jpeg", ".webp"], maxBytes: 20 * 1024 * 1024, // 20 MB description: "Scanned delivery notes, supplier GRNs, or photos of the docket.", }, "fuel-logs": { mimes: ["text/csv", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"], extensions: [".csv", ".xls", ".xlsx"], maxBytes: 5 * 1024 * 1024, // 5 MB description: "Per-vehicle daily fuel-issue exports from the depot system.", }, "time-sheets": { mimes: ["text/csv", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"], extensions: [".csv", ".xls", ".xlsx"], maxBytes: 5 * 1024 * 1024, description: "Weekly or daily timesheet exports from the payroll system.", }, }; // --------------------------------------------------------------------------- // Upload history — empty until PocketBase is wired. The shape of each // entry matches `UploadEntry`; once your ingest pipeline lands in // lib/pb.ts, append live records here and the Uploads page will render // them (or replace this export entirely with a PB query). // --------------------------------------------------------------------------- export const UPLOAD_HISTORY: UploadEntry[] = []; // Helper for callers that want to filter by kind. Returns an empty array // when `UPLOAD_HISTORY` is empty. export function uploadsByKind(kind: UploadKind): UploadEntry[] { return UPLOAD_HISTORY.filter((u) => u.kind === kind); }