/** Hospitality Platform (Torbat Food) — shared TypeScript types aligned with backend DTOs. */

export type LifecycleStatus = "draft" | "active" | "inactive" | "suspended" | "archived";
export type VenueFormat =
  | "cafe"
  | "coffee_shop"
  | "restaurant"
  | "fast_food"
  | "bakery"
  | "pastry"
  | "ice_cream"
  | "juice_bar"
  | "cloud_kitchen"
  | "food_court"
  | "catering"
  | "take_away"
  | "other";

export type BundleKey =
  | "digital_menu"
  | "qr_menu"
  | "qr_ordering"
  | "pos_lite"
  | "pos_pro"
  | "kitchen"
  | "reservation"
  | "table_service"
  | "delivery_connector"
  | "accounting_connector"
  | "crm_connector"
  | "loyalty_connector"
  | "communication_connector"
  | "website_connector"
  | "analytics"
  | "ai_assistant";

export type BundleStatus = "available" | "active" | "suspended" | "retired";
export type TableStatus = "available" | "occupied" | "reserved" | "cleaning" | "out_of_service";
export type MenuStatus = "draft" | "published" | "archived";

export type OrmBase = {
  id: string;
  tenant_id: string;
  is_deleted: boolean;
  created_by: string | null;
  updated_by: string | null;
  created_at: string;
  updated_at: string;
};

export type ListParams = { page?: number; page_size?: number };

export type HealthResponse = { status: string; service: string; version: string };

export type CapabilitiesResponse = {
  service: string;
  version: string;
  phase: string;
  product: string;
  platform: string;
  features: Record<string, boolean>;
  venue_formats: VenueFormat[];
  bundles: BundleKey[];
  independence: {
    standalone: boolean;
    superapp: boolean;
    integrations: string[];
    integration_mode: string;
  };
};

export type Venue = OrmBase & {
  code: string;
  name: string;
  description: string | null;
  status: LifecycleStatus;
  venue_format: VenueFormat;
  legal_name: string | null;
  timezone: string;
  language: string;
  currency_code: string;
  settings: Record<string, unknown> | null;
  version: number;
};

export type Branch = OrmBase & {
  venue_id: string;
  code: string;
  name: string;
  description: string | null;
  status: LifecycleStatus;
  address: Record<string, unknown> | null;
  timezone: string | null;
  working_hours: Record<string, unknown> | null;
  metadata_json: Record<string, unknown> | null;
};

export type DiningArea = OrmBase & {
  venue_id: string;
  branch_id: string | null;
  code: string;
  name: string;
  description: string | null;
  status: LifecycleStatus;
  sort_order: number;
  metadata_json: Record<string, unknown> | null;
};

export type DiningTable = OrmBase & {
  venue_id: string;
  dining_area_id: string | null;
  code: string;
  name: string;
  capacity: number;
  status: TableStatus;
  qr_token: string | null;
  metadata_json: Record<string, unknown> | null;
};

export type Menu = OrmBase & {
  venue_id: string;
  code: string;
  name: string;
  description: string | null;
  status: MenuStatus;
  is_default: boolean;
  currency_code: string;
  version: number;
};

export type MenuCategory = OrmBase & {
  venue_id: string;
  menu_id: string;
  code: string;
  name: string;
  description: string | null;
  sort_order: number;
};

export type MenuItem = OrmBase & {
  menu_id: string;
  category_id: string | null;
  code: string;
  name: string;
  description: string | null;
  status: LifecycleStatus;
  base_price: number;
  is_vegetarian: boolean;
  is_vegan: boolean;
  is_gluten_free: boolean;
  preparation_minutes: number | null;
  calories: number | null;
  spicy_level: number | null;
  tags: string[] | null;
  primary_media_ref: string | null;
};
