import type { CartItem } from "@/lib/stores/cartStore"; import type { EmergencyContact } from "@/lib/stores/emergencyContactStore"; import type { FamilyMember } from "@/lib/stores/familyStore"; import type { Order } from "@/lib/stores/ordersStore"; import type { DoseLog, Prescription, Reminder, } from "@/lib/stores/prescriptionStore"; import type { RefillSubscription } from "@/lib/stores/subscriptionStore"; import { products } from "@/lib/data/products"; function daysAgo(n: number) { const d = new Date(); d.setDate(d.getDate() - n); return d.toISOString(); } function daysFromNow(n: number) { const d = new Date(); d.setDate(d.getDate() + n); return d.toISOString(); } function hoursFromNow(n: number) { const d = new Date(); d.setHours(d.getHours() + n); return d.toISOString(); } const panadol = products.find((p) => p.id === "p1")!; const metformin = products.find((p) => p.id === "p7")!; const vitaminC = products.find((p) => p.id === "p14")!; const azitro = products.find((p) => p.id === "p9")!; const gofen = products.find((p) => p.id === "p16")!; function asCartItem(product: (typeof products)[0], quantity: number): CartItem { return { productId: product.id, slug: product.slug, name: product.name, price: product.price, image: product.image, unit: product.unit, quantity, requiresPrescription: product.requiresPrescription, }; } export const seedPrescriptions: Prescription[] = [ { id: "rx_demo_metformin", patientName: "Kirukib Abebe", memberId: null, medicineName: "Metformin 500mg", medicines: [ { name: "Metformin 500mg", status: "ready" }, { name: "Vitamin B12", status: "ready" }, ], imageUris: [ "https://images.unsplash.com/photo-1584308666744-24d5c474f2ae?w=800&q=80", ], daysSupply: 30, lastFilledAt: daysAgo(25), status: "filled", notes: "Take with meals. Monitor fasting glucose weekly.", createdAt: daysAgo(26), }, { id: "rx_demo_azitro", patientName: "Kirukib Abebe", memberId: null, medicineName: "Azithromycin 500mg", medicines: [ { name: "Azithromycin 500mg", status: "ready" }, { name: "Cough syrup", status: "review" }, ], imageUris: [ "https://images.unsplash.com/photo-1587854692152-cbe660dbde88?w=800&q=80", ], daysSupply: 3, lastFilledAt: daysAgo(1), status: "approved", notes: "3-day course. Finish even if symptoms improve.", createdAt: daysAgo(2), }, { id: "rx_demo_pending", patientName: "Sara Abebe", memberId: "fam_demo_sara", medicineName: "Amoxicillin 500mg", medicines: [ { name: "Amoxicillin 500mg", status: "review" }, { name: "ORS sachets", status: "ready" }, ], imageUris: [ "https://images.unsplash.com/photo-1471864190281-a93a3070b6de?w=800&q=80", ], daysSupply: 7, lastFilledAt: null, status: "under_review", notes: "Pharmacist verifying dosage for pediatric use.", createdAt: daysAgo(0), }, ]; export const seedReminders: Reminder[] = [ { id: "rem_demo_metformin", prescriptionId: "rx_demo_metformin", medicineName: "Metformin 500mg", times: ["08:00", "20:00"], daysOfWeek: [0, 1, 2, 3, 4, 5, 6], graceMinutes: 30, escalateOnMiss: true, memberId: null, enabled: true, }, { id: "rem_demo_azitro", prescriptionId: "rx_demo_azitro", medicineName: "Azithromycin 500mg", times: ["09:00"], daysOfWeek: [1, 2, 3], graceMinutes: 20, escalateOnMiss: true, memberId: null, enabled: true, }, ]; export const seedDoseLogs: DoseLog[] = [ { id: "dose_demo_1", reminderId: "rem_demo_metformin", scheduledAt: hoursFromNow(-2), status: "taken", confirmedAt: hoursFromNow(-1.8), }, { id: "dose_demo_2", reminderId: "rem_demo_metformin", scheduledAt: hoursFromNow(4), status: "pending", }, { id: "dose_demo_3", reminderId: "rem_demo_azitro", scheduledAt: hoursFromNow(1), status: "pending", }, ]; export const seedOrders: Order[] = [ { id: "ord_demo_active", createdAt: daysAgo(0), items: [asCartItem(panadol, 2), asCartItem(vitaminC, 1)], subtotal: panadol.price * 2 + vitaminC.price, deliveryFee: 80, discount: 0, total: panadol.price * 2 + vitaminC.price + 80, fulfillment: "delivery", branchId: "bole", areaLabel: "Bole, Addis Ababa", addressLine: "Rwanda St, Building 12, Apt 4B · Near Edna Mall", paymentMethod: "chapa", status: "dispatched", riderAssigned: true, customerName: "Kirukib Abebe", customerPhone: "+251911000000", notes: "Leave with security if I'm out", }, { id: "ord_demo_pickup", createdAt: daysAgo(3), items: [asCartItem(metformin, 1)], subtotal: metformin.price, deliveryFee: 0, discount: 0, total: metformin.price, fulfillment: "pickup", branchId: "cmc", areaLabel: "CMC Michael", paymentMethod: "pay_at_branch", status: "confirmed", riderAssigned: false, customerName: "Kirukib Abebe", customerPhone: "+251911000000", notes: "Prescription refill — patient ID on file", pickupCode: "GSH-CMC1", anyBranch: false, }, { id: "ord_demo_guest_code", createdAt: daysAgo(1), items: [asCartItem(panadol, 1)], subtotal: panadol.price, deliveryFee: 0, discount: 0, total: panadol.price, fulfillment: "pickup", branchId: null, areaLabel: "Any Gishen branch", paymentMethod: "pay_at_branch", status: "requested", riderAssigned: false, customerName: "Guest Shopper", customerPhone: "+251900111222", notes: "Guest pharmacist order code — create in admin", pickupCode: "GSH-GUEST", anyBranch: true, isGuestOrder: true, }, { id: "ord_demo_done", createdAt: daysAgo(12), items: [asCartItem(gofen, 1), asCartItem(azitro, 1)], subtotal: gofen.price + azitro.price, deliveryFee: 80, discount: 32, voucherCode: "GISHEN10", total: gofen.price + azitro.price + 80 - 32, fulfillment: "delivery", branchId: "mexico", areaLabel: "Mexico Square", addressLine: "Gabon St, Yaltopia Tower, Floor 6", paymentMethod: "telebirr", status: "delivered", riderAssigned: true, customerName: "Kirukib Abebe", customerPhone: "+251911000000", }, ]; export const seedFamily: FamilyMember[] = [ { id: "fam_demo_sara", name: "Sara Abebe", relationship: "spouse", phone: "+251911223344", status: "accepted", }, { id: "fam_demo_yonas", name: "Yonas Abebe", relationship: "child", phone: "+251922334455", status: "accepted", }, { id: "fam_demo_pending", name: "Hanna Bekele", relationship: "parent", phone: "+251933445566", status: "pending", }, ]; export const seedSubscriptions: RefillSubscription[] = [ { id: "sub_demo_metformin", productId: "p7", productName: "Metformin", quantity: 1, frequencyDays: 30, fulfillment: "delivery", paymentMethod: "chapa", memberId: null, status: "active", nextFulfillmentAt: daysFromNow(5), }, { id: "sub_demo_vitc", productId: "p14", productName: "Nat C (Vitamin C)", quantity: 2, frequencyDays: 60, fulfillment: "pickup", paymentMethod: "telebirr", memberId: null, status: "paused", nextFulfillmentAt: daysFromNow(20), }, ]; export const seedEmergencyContacts: EmergencyContact[] = [ { id: "ec_demo_1", name: "Sara Abebe", phone: "+251911223344", relationship: "Spouse", }, { id: "ec_demo_2", name: "Dr. Michael Tadesse", phone: "+251911000111", relationship: "Family doctor", }, ]; export const seedFavoriteIds = ["p1", "p7", "p14", "p16", "p39"]; export const DEMO_USER = { id: "u_demo_gishen", name: "Kirukib Abebe", phone: "+251911000000", email: "kirukib@example.com", points: 420, tier: "silver" as const, isGuest: false, biometricEnabled: false, avatarUri: null as string | null, authProvider: "phone" as const, };