export interface Category {
  id: number | string;
  name: string;
  slug: string;
  description?: string;
  image: string;
  iconUrl?: string; // keeping for backward compatibility if needed
}

export interface Product {
  id: number | string;
  name: string;
  description: string;
  slug?: string;
  seo_title?: string;
  seo_description?: string;
  seo_keywords?: string;
  price: number;
  oldPrice: number | null;
  old_price?: number | null; // Laravel naming
  image: string;
  imageUrl?: string; // mapping helper
  unit: string;
  rating: number;
  average_rating?: number;
  reviews_avg_rating?: number; // Laravel standard
  reviews_count?: number;      // Laravel standard
  isPopular: boolean;
  is_popular?: boolean; // Laravel naming
  categoryId?: string;
  category_name?: string;
}

export interface Banner {
  id: number;
  title: string;
  image: string;
  link: string | null;
  subtitle?: string;
  description?: string;
  color?: string;
  textColor?: string;
  buttonColor?: string;
}

export interface Settings {
  [key: string]: string;
}

export interface ApiResponse<T> {
  status: string;
  data: T;
  message?: string;
}

export interface PaginatedResponse<T> {
  data: T[];
  current_page: number;
  last_page: number;
  total: number;
  per_page: number;
}

export interface DeliveryType {
  id: number;
  name: string;
  cost: number;
  estimated_time?: string;
}

export interface PaymentMethod {
  id: number;
  name: string;
  type: 'cod' | 'stripe' | 'paypal' | 'paytm' | 'razorpay' | 'other';
  image?: string;
}

export interface Order {
  id?: number;
  order_number?: string;
  delivery_type_id: number;
  payment_method_id: number;
  subtotal?: number;
  delivery_fee?: number;
  tax?: number;
  discount?: number;
  discount_amount?: number;
  total?: number;
  status?: string;
  payment_status?: string;
  transaction_id?: string;
  shipping_address: {
    name: string;
    first_name: string;
    last_name: string;
    address: string;
    city: string;
    zip: string;
    phone: string;
  };
  items: {
    id?: number;
    product_id: string | number;
    product?: Product;
    quantity: number;
    price?: number;
  }[];
  notes?: string;
  coupon_code?: string;
  created_at?: string;
}

export interface SupportTicket {
  id: number;
  subject: string;
  status: "open" | "pending" | "closed" | string;
  priority?: string | null;
  order_id?: number | null;
  order_number?: string | null;
  created_at: string;
  last_message_at?: string | null;
  last_message_preview?: string | null;
  last_message_is_admin?: boolean | null;
}

export interface SupportMessage {
  id: number;
  support_ticket_id: number;
  user_id?: number | null;
  is_admin: boolean;
  message: string;
  created_at: string;
}

export interface Coupon {
  id: number;
  code: string;
  discount_amount: number;
  min_spend: number;
}
