// --- User & Auth ---
export interface User {
  id: number
  name: string
  email: string
  phone: string
  role: string[]
  company_id?: number
  avatar?: string
  email_verified_at?: string | null
  created_at?: string
  updated_at?: string
}

export interface AuthTokens {
  access_token: string
  refresh_token?: string
  token_type: string
  expires_in?: number
}

export interface LoginPayload {
  email: string
  password: string
}

export interface RegisterPayload {
  name: string
  email: string
  password: string
  password_confirmation: string
  phone: string
  company_name?: string
  [key: string]: unknown
}

// --- Products ---
export interface Product {
  id: number
  name: string
  description?: string
  price?: number
  category_id?: number
  images?: ProductImage[]
  rating?: number
  created_at?: string
  updated_at?: string
  [key: string]: unknown
}

export interface ProductImage {
  id: number
  url: string
  product_id: number
}

// --- Categories ---
export interface Category {
  id: number
  name: string
  image?: string
  parent_id?: number | null
  children?: Category[]
}

// --- Orders ---
export interface Order {
  id: number
  status: string
  total?: number
  items?: OrderItem[]
  created_at?: string
  updated_at?: string
  [key: string]: unknown
}

export interface OrderItem {
  id: number
  product_id: number
  quantity: number
  price: number
  product?: Product
}

// --- Deals ---
export interface Deal {
  id: number
  product_id: number
  status: string
  category_id?: number
  product?: Product
  created_at?: string
  [key: string]: unknown
}

export interface Bid {
  id: number
  deal_id: number
  price: number
  status: string
  [key: string]: unknown
}

// --- Submissions ---
export interface Submission {
  id: number
  status: string
  deal_id?: number
  [key: string]: unknown
}

// --- Chat ---
export interface ChatMessage {
  message: string | null
  sender_id: number
  receiver_id: number
  created_at: Date | string
  is_file?: number
  seen_status: boolean
  message_id?: string
  firestore_id?: string
  file?: File
  name?: string
  type?: string
  url?: string
}

// --- API ---
export interface ApiResponse<T = unknown> {
  data: T
  status: number
  message?: string
}

export interface PaginatedResponse<T = unknown> {
  data: T[]
  current_page: number
  last_page: number
  per_page: number
  total: number
}

// --- Wishlist ---
export interface WishlistItem {
  id: number
  product_id: number
  product?: Product
}

// --- Misc ---
export interface ContactForm {
  name: string
  email: string
  phone: string
  message: string
  type_id?: number
}

export interface Rating {
  id: number
  score: number
  comment?: string
  order_id?: number
  product_id?: number
}

// --- Transactions ---
export interface Transaction {
  id: number
  type: string
  amount: number
  description?: string
  created_at?: string
  [key: string]: unknown
}

// --- Vendors ---
export interface Vendor {
  id: number
  name: string
  logo?: string
  company_id?: number
  [key: string]: unknown
}

// --- Testimonials ---
export interface Testimonial {
  id: number
  name: string
  content: string
  avatar?: string
  position?: string
  [key: string]: unknown
}

// --- Sliders ---
export interface Slider {
  id: number
  image: string
  title?: string
  description?: string
  url?: string
  [key: string]: unknown
}

// --- Contact ---
export interface ContactType {
  id: number
  name: string
}

// --- Countries & Cities ---
export interface Country {
  id: number
  name: string
  cities?: City[]
}

export interface City {
  id: number
  name: string
  country_id: number
}

// --- Company / Branch ---
export interface Company {
  id: number
  name: string
  logo?: string
  branches?: Branch[]
  [key: string]: unknown
}

export interface Branch {
  id: number
  name: string
  address?: string
  city_id?: number
  country_id?: number
  lat?: number
  lng?: number
  [key: string]: unknown
}

// --- Shipment ---
export interface Shipment {
  id: number
  order_id: number
  status: string
  tracking_url?: string
  shipment_number?: string
  [key: string]: unknown
}

// --- Batches/Patches ---
export interface Batch {
  id: number
  deal_id?: number
  quantity: number
  batch_number?: string
  expiry_date?: string
  mfg_date?: string
  [key: string]: unknown
}

// --- Notification ---
export interface AppNotification {
  id: number
  title: string
  body: string
  read: boolean
  created_at?: string
  action_type?: string
  action_id?: number
}
