// ============================================================
// All shared TypeScript types
// ============================================================

export interface User {
  id: string;
  name: string;
  email: string;
  phone?: string | null;
  address?: string | null;
  role: 'customer' | 'admin';
}

export interface Product {
  id: string;
  name: string;
  description?: string | null;
  price: number;
  category: string;
  image?: string | null;
  stock: number;
  is_active: 0 | 1;
  created_at: string;
}

export interface OrderItem {
  id: string;
  order_id: string;
  product_id?: string | null;
  product_name?: string | null;
  category?: string | null;
  quantity: number;
  price: number;
}

export type OrderStatus =
  | 'pending'
  | 'confirmed'
  | 'out_for_delivery'
  | 'delivered'
  | 'cancelled';

export interface Order {
  id: string;
  user_id: string;
  status: OrderStatus;
  total: number;
  fulfillment: 'delivery' | 'pickup';
  payment_method: 'cod';
  address?: string | null;
  notes?: string | null;
  created_at: string;
  items?: OrderItem[];
  customer_name?: string;
  customer_email?: string;
  customer_phone?: string;
}

export interface CartItem {
  product: Product;
  quantity: number;
}

export interface GalleryItem {
  id: string;
  title: string;
  description?: string | null;
  image_url: string;
  category?: string;
  is_active: 0 | 1;
  created_at: string;
}

export interface ContactMessage {
  id: string;
  name: string;
  phone: string;
  service?: string;
  message: string;
  is_read: 0 | 1;
  created_at: string;
}

export interface Stats {
  totalOrders: number;
  totalCustomers: number;
  totalProducts: number;
  pendingOrders: number;
  estimatedRevenue: number;
  unreadMessages: number;
}
