import { LucideIcon } from 'lucide-react'

// Основные типы данных
export interface Supply {
  id: string
  productId?: string // ID продукта для фильтрации истории поставок
  name: string
  description: string
  price: number
  quantity: number
  unit: string
  category: string
  status: string
  date: string
  supplier: string
  minStock: number
  currentStock: number
  imageUrl?: string
  createdAt: string
  updatedAt: string
  shippedQuantity?: number // Отправленное количество
}

export interface FilterState {
  search: string
  category: string
  status: string
  supplier: string
  lowStock: boolean
}

export interface SortState {
  field: 'name' | 'category' | 'status' | 'currentStock' | 'price' | 'supplier'
  direction: 'asc' | 'desc'
}

export interface StatusConfig {
  label: string
  color: string
  icon: LucideIcon
}

export interface DeliveryStatusConfig {
  label: string
  color: string
  icon: LucideIcon
}

export type ViewMode = 'grid' | 'list' | 'analytics'
export type GroupBy = 'none' | 'category' | 'status' | 'supplier'

// Пропсы для компонентов
export interface SupplyCardProps {
  supply: Supply
  isExpanded: boolean
  onToggleExpansion: (id: string) => void
  getSupplyDeliveries: (supply: Supply) => Supply[]
  getStatusConfig: (supply: Supply) => StatusConfig
}

export interface SuppliesGridProps {
  supplies: Supply[]
  expandedSupplies: Set<string>
  onToggleExpansion: (id: string) => void
  getSupplyDeliveries: (supply: Supply) => Supply[]
  getStatusConfig: (supply: Supply) => StatusConfig
}

export interface SuppliesListProps {
  supplies: Supply[]
  expandedSupplies: Set<string>
  onToggleExpansion: (id: string) => void
  getSupplyDeliveries: (supply: Supply) => Supply[]
  getStatusConfig: (supply: Supply) => StatusConfig
  sort: SortState
  onSort: (field: SortState['field']) => void
}

export interface SuppliesHeaderProps {
  viewMode: ViewMode
  onViewModeChange: (mode: ViewMode) => void
  groupBy: GroupBy
  onGroupByChange: (group: GroupBy) => void
  filters: FilterState
  onFiltersChange: (filters: FilterState) => void
  showFilters: boolean
  onToggleFilters: () => void
  onExport: () => void
  onRefresh: () => void
}

export interface SuppliesStatsProps {
  supplies: Supply[]
}

export interface DeliveryDetailsProps {
  supply: Supply
  deliveries: Supply[]
  viewMode: 'grid' | 'list'
  getStatusConfig: (status: string) => StatusConfig
}
