// ============================================================ // ScanMenu – Complete Database Types // ============================================================ export type UserRole = 'admin' | 'owner' | 'staff' | 'customer'; export type OrderStatus = 'pending' | 'confirmed' | 'preparing' | 'ready' | 'delivered' | 'cancelled'; export type OrderType = 'dine_in' | 'takeaway' | 'delivery'; export type SubscriptionTier = 'free' | 'starter' | 'pro' | 'enterprise'; export type SubscriptionStatus = 'active' | 'past_due' | 'cancelled' | 'trialing'; export interface User { id: string; email: string; full_name: string; avatar_url?: string; role: UserRole; created_at: string; updated_at: string; } export interface Restaurant { id: string; owner_id: string; name: string; slug: string; description?: string; logo_url?: string; cover_image_url?: string; address?: string; phone?: string; email?: string; website?: string; currency: string; timezone: string; is_active: boolean; opening_hours?: Record; theme_color: string; created_at: string; updated_at: string; } export interface Menu { id: string; restaurant_id: string; name: string; description?: string; is_active: boolean; sort_order: number; created_at: string; updated_at: string; } export interface Category { id: string; menu_id: string; restaurant_id: string; name: string; description?: string; image_url?: string; is_active: boolean; sort_order: number; created_at: string; updated_at: string; } export interface Product { id: string; category_id: string; restaurant_id: string; name: string; description?: string; price: number; image_url?: string; is_available: boolean; is_featured: boolean; preparation_time?: number; // minutes calories?: number; allergens?: string[]; tags?: string[]; sort_order: number; created_at: string; updated_at: string; } export interface ProductOption { id: string; product_id: string; name: string; // e.g. "Size", "Spice Level" type: 'single' | 'multiple'; required: boolean; min_selections?: number; max_selections?: number; sort_order: number; } export interface ProductOptionItem { id: string; option_id: string; name: string; // e.g. "Small", "Medium", "Large" price_modifier: number; is_default: boolean; sort_order: number; } export interface Table { id: string; restaurant_id: string; number: string; name?: string; capacity?: number; is_active: boolean; qr_code_id?: string; created_at: string; } export interface QRCode { id: string; restaurant_id: string; table_id?: string; label: string; url: string; scans: number; is_active: boolean; created_at: string; } export interface Order { id: string; restaurant_id: string; customer_name?: string; customer_phone?: string; customer_email?: string; order_type: OrderType; table_number?: string; status: OrderStatus; subtotal: number; tax: number; total: number; notes?: string; delivery_address?: string; estimated_time?: number; created_at: string; updated_at: string; } export interface OrderItem { id: string; order_id: string; product_id: string; product_name: string; quantity: number; unit_price: number; total_price: number; options?: Record; notes?: string; } export interface Subscription { id: string; restaurant_id: string; stripe_customer_id?: string; stripe_subscription_id?: string; tier: SubscriptionTier; status: SubscriptionStatus; current_period_start?: string; current_period_end?: string; created_at: string; updated_at: string; } export interface AnalyticsEvent { id: string; restaurant_id: string; event_type: string; event_data?: Record; created_at: string; } // ============================================================ // Cart Types (Client-side) // ============================================================ export interface CartItem { id: string; product: Product; quantity: number; options: Record; notes?: string; total: number; } export interface Cart { restaurant_id: string; restaurant_name: string; items: CartItem[]; order_type: OrderType; table_number?: string; subtotal: number; tax: number; total: number; }