export interface Product {
  id: string;
  name: string;
  slug: string;
  short_description: string;
  description: string;
  price: number;
  compare_at_price: number | null;
  cost_price: number | null;
  tax_rate: number;
  sku: string;
  stock: number;
  category_id: string | null;
  product_type: 'vue' | 'soleil' | 'accessoire';
  frame_shape: string;
  material: string;
  color: string;
  lens_width: number | null;
  bridge_width: number | null;
  temple_length: number | null;
  lens_height: number | null;
  lens_type: string;
  uv_protection: boolean;
  prescription_compatible: boolean;
  gender: 'femme' | 'homme' | 'mixte' | 'enfant';
  brand: string;
  is_new: boolean;
  is_bestseller: boolean;
  is_limited: boolean;
  is_active: boolean;
  seo_title: string;
  seo_description: string;
  created_at: string;
  updated_at: string;
  product_images?: ProductImage[];
  product_variants?: ProductVariant[];
  category?: Category;
  reviews?: Review[];
}

export interface ProductImage {
  id: string;
  product_id: string;
  url: string;
  alt: string;
  display_order: number;
  is_primary: boolean;
}

export interface ProductVariant {
  id: string;
  product_id: string;
  name: string;
  color: string;
  sku: string;
  price_modifier: number;
  stock: number;
  is_active: boolean;
}

export interface Category {
  id: string;
  name: string;
  slug: string;
  description: string;
  image_url: string;
  parent_id: string | null;
  seo_title: string;
  seo_description: string;
  display_order: number;
  is_active: boolean;
}

export interface Collection {
  id: string;
  name: string;
  slug: string;
  description: string;
  image_url: string;
  is_featured: boolean;
  is_active: boolean;
}

export interface HeroSlide {
  id: string;
  title: string;
  subtitle: string;
  button_text: string;
  button_link: string;
  button2_text: string;
  button2_link: string;
  image_url: string;
  video_url: string;
  display_order: number;
  is_active: boolean;
}

export interface HomepageSection {
  id: string;
  section_key: string;
  title: string;
  subtitle: string;
  content: Record<string, unknown>;
  display_order: number;
  is_active: boolean;
}

export interface BlogPost {
  id: string;
  title: string;
  slug: string;
  excerpt: string;
  content: string;
  cover_image_url: string;
  image_alt: string;
  category: string;
  author_name: string;
  reading_time_minutes: number;
  seo_title: string;
  seo_description: string;
  is_published: boolean;
  published_at: string | null;
  created_at: string;
  updated_at: string;
}

export interface Review {
  id: string;
  product_id: string;
  user_id: string | null;
  author_name: string;
  rating: number;
  comment: string;
  is_approved: boolean;
  created_at: string;
}

export interface Order {
  id: string;
  user_id: string | null;
  order_number: string;
  status: string;
  subtotal: number;
  shipping_cost: number;
  discount_amount: number;
  tax_amount: number;
  total: number;
  coupon_code: string | null;
  payment_method: string;
  payment_status: string;
  stripe_payment_intent_id: string | null;
  alma_payment_id: string | null;
  shipping_method: string;
  tracking_number: string;
  notes: string;
  billing_first_name: string;
  billing_last_name: string;
  billing_street: string;
  billing_city: string;
  billing_postal_code: string;
  billing_country: string;
  billing_phone: string;
  billing_email: string;
  shipping_first_name: string;
  shipping_last_name: string;
  shipping_street: string;
  shipping_city: string;
  shipping_postal_code: string;
  shipping_country: string;
  shipping_phone: string;
  created_at: string;
  updated_at: string;
  order_items?: OrderItem[];
}

export interface OrderItem {
  id: string;
  order_id: string;
  product_id: string | null;
  variant_id: string | null;
  product_name: string;
  product_sku: string;
  quantity: number;
  unit_price: number;
  total_price: number;
}

export interface CartLensConfig {
  offerName: string;
  offerPrice: number;
  options: { name: string; price: number }[];
}

export interface CartItem {
  product: Product;
  quantity: number;
  variant?: ProductVariant;
  lensConfig?: CartLensConfig;
}

export interface Coupon {
  id: string;
  code: string;
  type: 'percentage' | 'fixed';
  value: number;
  min_order_amount: number;
  max_uses: number;
  uses_count: number;
  max_uses_per_customer: number;
  starts_at: string | null;
  expires_at: string | null;
  is_active: boolean;
}

export interface CrossSellRule {
  id: string;
  name: string;
  trigger_type: string;
  trigger_value: string;
  recommended_product_ids: string[];
  display_text: string;
  display_order: number;
  is_active: boolean;
}

export interface Address {
  id: string;
  user_id: string;
  label: string;
  first_name: string;
  last_name: string;
  street: string;
  street2: string;
  city: string;
  postal_code: string;
  country: string;
  phone: string;
  is_default: boolean;
}

export interface Profile {
  id: string;
  email: string;
  first_name: string;
  last_name: string;
  phone: string;
  role: 'customer' | 'admin' | 'manager';
  created_at: string;
  updated_at: string;
}
