import { z } from 'zod'; /** * Cloud-generated insights synced to device (strategy P3: Insight sync). * Example: "Your margin on biscuits dropped 8% this week. Consider switching to Supplier B." */ export const insightTypeEnum = z.enum([ 'margin_alert', 'restock_suggestion', 'weekly_summary', 'supplier_tip', 'expiry_alert', 'anomaly', 'bestseller_shift', 'custom', ]); export const insightEngagementTypeEnum = z.enum(['acted_on', 'dismissed', 'ignored']); export const shopInsightSchema = z.object({ id: z.string().uuid(), type: insightTypeEnum, title: z.string(), body: z.string(), payload: z.record(z.unknown()).nullable(), readAt: z.coerce.date().nullable(), engagementType: insightEngagementTypeEnum.nullable(), engagedAt: z.coerce.date().nullable(), createdAt: z.coerce.date(), }); export type ShopInsight = z.infer;