import type { LucideIcon } from "lucide-react"
import type React from "react"

export interface ProductModalProps {
  open: boolean
  productData: ProductData
  categories: Category[]
  editing: boolean
  onClose: () => void
  onSave: (productData: ProductData, imageFile?: File | null) => void;
  handleChange: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void
  handleTieredPricingChange: (e: React.ChangeEvent<HTMLInputElement>, index: number) => void
  handleAddTier: () => void
  handleRemoveTier: (index: number) => void
  setProductData: React.Dispatch<React.SetStateAction<ProductData>>
}

export interface ShippingMethod {
  _id?: string
  name: string
  price: number
}

export interface ShippingData {
  _id?: string
  name: string
  price: number
}

export type ApiResponse<T> = {
  data?: T
  error?: string
  total?: number
}

export interface Product {
  _id?: string
  name: string
  description: string
  stock?: number
  stockTracking?: boolean
  currentStock?: number
  lowStockThreshold?: number
  stockStatus?: 'in_stock' | 'low_stock' | 'out_of_stock'
  unitType: 'pcs' | 'gr' | 'kg' | 'ml' | 'oz' | 'lb'
  category: string
  enabled?: boolean
  pricing: PricingTier[]
  image?: string | File | null
  costPerUnit?: number // Cost price for profit calculations
}

export interface ProductData extends Product {}

export interface PricingTier {
  minQuantity: number
  pricePerUnit: number
  _id?: string
}

export interface Category {
  _id: string
  name: string
  parentId?: string
}

export interface OrderStatsData {
  totalOrders: number
  pendingOrders: number
  completedOrders: number
  cancelledOrders: number
}

export interface Order {
  _id: string
  orderId: string
  status: OrderStatus
  totalPrice: number
  createdAt: string
  telegramUsername?: string
  underpaid?: boolean
  underpaymentAmount?: number
  lastBalanceReceived?: number
  underpaymentNotified?: boolean
  cryptoTotal?: number
}

export type OrderStatus = "paid" | "unpaid" | "confirming" | "shipped" | "completed" | "disputed" | "cancelled"

export interface StatusConfig {
  icon: LucideIcon
  color: string
  animate?: string
}