import type { ChipProps } from '@mui/material/Chip'
import type { ORDER_STATUS, ORDER_TYPE, PAYMENT_STATUS } from '@/types/data'

export const statusOptions: ORDER_STATUS[] = [
  'pending',
  'confirmed',
  'preparing',
  'ready',
  'delivered',
  'completed',
  'cancelled'
]

export const paymentOptions: PAYMENT_STATUS[] = ['pending', 'paid', 'failed', 'refunded']

export const statusChipMeta: Record<ORDER_STATUS, { color: ChipProps['color']; icon: string }> = {
  pending: { color: 'warning', icon: 'tabler-clock' },
  confirmed: { color: 'info', icon: 'tabler-check' },
  preparing: { color: 'info', icon: 'tabler-chef-hat' },
  ready: { color: 'success', icon: 'tabler-bell' },
  delivered: { color: 'success', icon: 'tabler-truck' },
  completed: { color: 'secondary', icon: 'tabler-confetti' },
  cancelled: { color: 'error', icon: 'tabler-ban' }
}

export const typeChipMeta: Record<ORDER_TYPE, { color: ChipProps['color']; icon: string }> = {
  dine_in: { color: 'primary', icon: 'tabler-armchair' },
  takeaway: { color: 'secondary', icon: 'tabler-shopping-bag' },
  delivery: { color: 'info', icon: 'tabler-bike' }
}

export const paymentChipMeta: Record<PAYMENT_STATUS, { color: ChipProps['color']; icon: string }> = {
  pending: { color: 'warning', icon: 'tabler-clock-dollar' },
  paid: { color: 'success', icon: 'tabler-cash' },
  failed: { color: 'error', icon: 'tabler-alert-triangle' },
  refunded: { color: 'info', icon: 'tabler-rotate' }
}

export type SecondaryAction =
  | 'delivery_fee'
  | 'service_fee'
  | 'tax'
  | 'discount'
  | 'notes'
  | 'address'
  | 'table'
  | 'estimate'
  | 'cancel'
