import { z } from "zod"; export const addNewMenuItemSchema = z.object({ HOT: z.number().nullable(), COLD: z.number().nullable(), price: z.number().nullable(), category: z.string(), }); export type AddNewMenuItemType = z.infer; export const updateMenuItemSchema = z.object({ HOT: z.number().nullable().optional(), COLD: z.number().nullable().optional(), price: z.number().nullable().optional(), category: z.string().optional(), }); export type UpdateMenuItemType = z.infer; const paymentMethodSchema = z.enum(["account", "cash"]); export type PaymentMethod = z.infer; /** * SQLite has no Boolean datatype. Use cast(true|false|SqliteBoolean). * https://www.sqlite.org/quirks.html#no_separate_boolean_datatype */ export const SqliteBooleanSchema = z .union([z.literal(0), z.literal(1)]); export type SqliteBoolean = z.infer; const orderSchema = z.object({ name: z.string(), quantity: z.number(), price: z.number(), HOT: SqliteBooleanSchema, }); export type OrderType = z.infer; export const addNewOrderSchema = z.object({ orders: z.array(orderSchema), payment: paymentMethodSchema, }); export type AddNewOrderType = z.infer;