// Mirrors supabase/migrations/20260819000000_initial_schema.sql.
// Kept hand-written for V1; consider generating via `supabase gen types` once
// the schema stabilizes.

export type SubscriptionStatus = "active" | "grace_period" | "suspended" | "deleted";
export type AiImportStatus = "pending" | "processing" | "completed" | "failed";
export type DomainStatus = "pending" | "verified" | "failed";

export interface Restaurant {
  id: string;
  name: string;
  slug: string;
  logoUrl: string | null;
  phone: string | null;
  address: string | null;
  createdAt: string;
}

export interface Location {
  id: string;
  restaurantId: string;
  name: string;
  address: string | null;
  phone: string | null;
}

export interface Menu {
  id: string;
  locationId: string;
  name: string;
  isPublished: boolean;
  publishedAt: string | null;
}

export interface MenuCategory {
  id: string;
  menuId: string;
  name: string;
  description: string | null;
  sortOrder: number;
  isActive: boolean;
}

export interface MenuItem {
  id: string;
  categoryId: string;
  name: string;
  description: string | null;
  price: number;
  imageUrl: string | null;
  sortOrder: number;
  isActive: boolean;
}

export interface MenuItemOption {
  id: string;
  menuItemId: string;
  groupName: string;
  label: string;
  priceDelta: number;
  sortOrder: number;
}

export interface AiImport {
  id: string;
  restaurantId: string;
  sourceImage: string;
  status: AiImportStatus;
  model: string | null;
  error: string | null;
  processedAt: string | null;
}

export interface AiImportItem {
  id: string;
  aiImportId: string;
  categoryName: string | null;
  itemName: string;
  description: string | null;
  price: number | null;
}

export interface AiExtractedItem {
  id: string;
  name: string;
  description?: string | null;
  price: number;
}

export interface AiExtractedCategory {
  id: string;
  name: string;
  items: AiExtractedItem[];
}

export interface AiImportResponse {
  importId: string;
  status: AiImportStatus;
  model: string | null;
  categories: AiExtractedCategory[];
  totalItems: number;
}

export interface AiImportApplyPayload {
  categories: {
    name: string;
    items: {
      name: string;
      description?: string | null;
      price: number;
    }[];
  }[];
}

export interface Subscription {
  id: string;
  restaurantId: string;
  status: SubscriptionStatus;
  productId: string | null;
  trialEndsAt: string | null;
  currentPeriodEndsAt: string | null;
}

export interface Domain {
  id: string;
  restaurantId: string;
  hostname: string;
  isCustom: boolean;
  status: DomainStatus;
}
