export type ProductItem = { id: number; product_code: string; name: string; category: string; description: string | null; price: number; sku: string | null; variations: string | null; average_rating: number | null; product_dimensions: string | null; }; export type InventoryItem = { id: number; quantity: number; last_updated: string; product: Pick; warehouse: { name: string; location_description?: string | null; }; }; export type ScanEvent = { id: number; timestamp: string; model_used: string | null; cv_results: { validation_status?: string; product_code?: string; product_name?: string; product_category?: string; product_sku?: string; product_price?: number; error_message?: string; payload_version?: number; quantity_before?: number; quantity_after?: number; }; }; export type WarehouseInfo = { id: number; name: string; location_description: string | null; }; export type WarehouseMetrics = { warehouse_id: number; warehouse_name: string; total_products: number; total_quantity: number; }; export type VLMStatus = { available: boolean; model: string; endpoint: string; gpu_usage?: number; memory_usage?: number; temperature?: number; }; export type AnalysisResult = { id: number; timestamp: string; prompt: string; response: string; latency_ms: number; model_used: string; analysis_type: string; }; const now = Date.now(); const minutesAgo = (minutes: number) => new Date(now - minutes * 60_000).toISOString(); export const products: ProductItem[] = [ { id: 1, product_code: "DX-PROP-1045-CF", name: "Carbon Fiber Propeller Set 10x4.5", category: "Drone Parts", description: "Balanced propeller pair for last-mile delivery quadcopters.", price: 34.5, sku: "PROP-1045-CF", variations: "Clockwise / Counter-clockwise", average_rating: 4.8, product_dimensions: "10 x 4.5 in" }, { id: 2, product_code: "DX-BAT-6S-22000", name: "6S Smart Battery Pack 22000mAh", category: "Power Systems", description: "High-discharge battery with telemetry and thermal protection.", price: 289.0, sku: "BAT-6S-22K", variations: "XT90 / AS150 connector", average_rating: 4.7, product_dimensions: "185 x 74 x 62 mm" }, { id: 3, product_code: "DX-PAYLOAD-BOX-M", name: "Insulated Payload Box Medium", category: "Payload", description: "Reusable insulated delivery container for temperature-sensitive parcels.", price: 72.25, sku: "BOX-INS-M", variations: "Blue / White", average_rating: 4.6, product_dimensions: "38 x 28 x 22 cm" }, { id: 4, product_code: "DX-CAM-C270-MNT", name: "C270 Scanner Camera Mount", category: "Scanner", description: "Vibration-damped mount for barcode and QR scanning cameras.", price: 18.95, sku: "CAM-MNT-C270", variations: "Standard rail", average_rating: 4.4, product_dimensions: "62 x 42 x 35 mm" }, { id: 5, product_code: "DX-FC-AERO-V2", name: "AeroStack Flight Controller V2", category: "Avionics", description: "Flight controller configured for autonomous warehouse-to-drone handoff.", price: 219.99, sku: "FC-AERO-V2", variations: "CAN / UART expansion", average_rating: 4.9, product_dimensions: "45 x 45 mm" }, { id: 6, product_code: "DX-LABEL-QR-500", name: "Tamper-Evident QR Label Roll", category: "Warehouse Supplies", description: "Weather-resistant QR labels for product and tote tracking.", price: 41.75, sku: "LBL-QR-500", variations: "500 labels", average_rating: 4.5, product_dimensions: "50 x 30 mm" }, { id: 7, product_code: "DX-DOCK-CHG-4", name: "Four-Bay Battery Charging Dock", category: "Power Systems", description: "Managed charging dock for rotating flight batteries.", price: 640.0, sku: "DOCK-CHG-4", variations: "EU / US power cable", average_rating: 4.8, product_dimensions: "52 x 36 x 18 cm" }, { id: 8, product_code: "DX-LIDAR-MINI", name: "Mini Obstacle Avoidance LiDAR", category: "Sensors", description: "Short-range LiDAR module for indoor navigation and docking.", price: 128.4, sku: "LIDAR-MINI", variations: "Front / Downward mount", average_rating: 4.3, product_dimensions: "43 x 31 x 26 mm" } ]; export const warehouses: WarehouseInfo[] = [ { id: 1, name: "Istanbul Fulfillment Hub", location_description: "Primary drone dispatch and inventory staging area" }, { id: 2, name: "Ankara Micro Hub", location_description: "Regional replenishment and spare-parts buffer" } ]; export const inventory: InventoryItem[] = [ { id: 101, quantity: 128, last_updated: minutesAgo(9), product: products[0], warehouse: warehouses[0] }, { id: 102, quantity: 42, last_updated: minutesAgo(18), product: products[1], warehouse: warehouses[0] }, { id: 103, quantity: 215, last_updated: minutesAgo(42), product: products[2], warehouse: warehouses[0] }, { id: 104, quantity: 17, last_updated: minutesAgo(54), product: products[3], warehouse: warehouses[0] }, { id: 105, quantity: 9, last_updated: minutesAgo(76), product: products[4], warehouse: warehouses[0] }, { id: 106, quantity: 640, last_updated: minutesAgo(88), product: products[5], warehouse: warehouses[0] }, { id: 107, quantity: 6, last_updated: minutesAgo(105), product: products[6], warehouse: warehouses[1] }, { id: 108, quantity: 23, last_updated: minutesAgo(132), product: products[7], warehouse: warehouses[1] } ]; export const scans: ScanEvent[] = [ { id: 501, timestamp: minutesAgo(3), model_used: "qr_scanner_demo", cv_results: { validation_status: "valid", product_code: products[1].product_code, product_name: products[1].name, product_category: products[1].category, product_sku: products[1].sku ?? undefined, product_price: products[1].price, payload_version: 2, quantity_before: 41, quantity_after: 42 } }, { id: 502, timestamp: minutesAgo(12), model_used: "qr_scanner_demo", cv_results: { validation_status: "valid", product_code: products[5].product_code, product_name: products[5].name, product_category: products[5].category, product_sku: products[5].sku ?? undefined, product_price: products[5].price, payload_version: 2, quantity_before: 639, quantity_after: 640 } }, { id: 503, timestamp: minutesAgo(21), model_used: "qr_scanner_demo", cv_results: { validation_status: "valid", product_code: products[0].product_code, product_name: products[0].name, product_category: products[0].category, product_sku: products[0].sku ?? undefined, product_price: products[0].price, payload_version: 2, quantity_before: 127, quantity_after: 128 } }, { id: 504, timestamp: minutesAgo(37), model_used: "qr_scanner_demo", cv_results: { validation_status: "valid", product_code: products[3].product_code, product_name: products[3].name, product_category: products[3].category, product_sku: products[3].sku ?? undefined, product_price: products[3].price, payload_version: 2, quantity_before: 16, quantity_after: 17 } } ]; export const analysisHistory: AnalysisResult[] = [ { id: 801, timestamp: minutesAgo(11), prompt: "Analyze this warehouse scene for operational risks.", response: "Demo analysis: inbound tote lane is clear, QR label visibility is good, and the battery dock area needs replenishment within the next shift.", latency_ms: 1240, model_used: "gemma-3-demo", analysis_type: "warehouse" }, { id: 802, timestamp: minutesAgo(28), prompt: "List visible inventory issues.", response: "Demo analysis: low stock on charging docks and flight controllers; all other highlighted categories remain above reorder thresholds.", latency_ms: 980, model_used: "gemma-3-demo", analysis_type: "inventory" } ]; export const delay = (value: T, ms = 180): Promise => new Promise((resolve) => window.setTimeout(() => resolve(value), ms)); export const getWarehouseMetrics = (warehouseId = 1): WarehouseMetrics => { const warehouse = warehouses.find((item) => item.id === warehouseId) ?? warehouses[0]; const rows = inventory.filter((item) => item.warehouse.name === warehouse.name); return { warehouse_id: warehouse.id, warehouse_name: warehouse.name, total_products: rows.length, total_quantity: rows.reduce((sum, item) => sum + item.quantity, 0) }; }; export const dashboardStats = { totalInventory: inventory.reduce((sum, item) => sum + item.quantity, 0), lowStockItems: inventory.filter((item) => item.quantity > 0 && item.quantity <= 20).length, outOfStockItems: 0, activeDrones: 7, totalOrders: 86, pendingOrders: 14, completedOrdersToday: 31, warehouseZones: 6, scanAccuracy: 98.4, fulfillmentRate: 94 }; export const recentActivity = [ { id: 1, type: "order", message: "Order DX-2409 dispatched to Kadikoy route", time: "5 min ago", status: "success" }, { id: 2, type: "inventory", message: "Low stock alert: Four-Bay Battery Charging Dock", time: "18 min ago", status: "warning" }, { id: 3, type: "scan", message: "QR scan verified Smart Battery Pack 22000mAh", time: "21 min ago", status: "success" }, { id: 4, type: "warehouse", message: "Istanbul Hub cycle count completed for Zone C", time: "44 min ago", status: "info" } ]; export const orders = [ { id: "DX-2409", destination: "Kadikoy Medical Center", status: "In flight", priority: "High", eta: "14 min", items: 3 }, { id: "DX-2410", destination: "Besiktas Micro Hub", status: "Picking", priority: "Normal", eta: "38 min", items: 6 }, { id: "DX-2411", destination: "Uskudar Pharmacy", status: "Ready", priority: "High", eta: "22 min", items: 2 }, { id: "DX-2412", destination: "Levent Service Point", status: "Queued", priority: "Normal", eta: "52 min", items: 4 } ]; export const weeklyThroughput = [ { day: "Mon", orders: 42, scans: 88 }, { day: "Tue", orders: 55, scans: 104 }, { day: "Wed", orders: 49, scans: 96 }, { day: "Thu", orders: 61, scans: 118 }, { day: "Fri", orders: 74, scans: 132 }, { day: "Sat", orders: 58, scans: 111 } ]; export const getDemoQrDataUrl = (label: string) => { const cells = Array.from({ length: 49 }, (_, index) => { const x = index % 7; const y = Math.floor(index / 7); const on = (label.charCodeAt(index % label.length) + index + x * y) % 3 !== 0; return on ? `` : ""; }).join(""); const svg = `${cells}${label}`; return `data:image/svg+xml;charset=UTF-8,${encodeURIComponent(svg)}`; };