export type LastSplitQuantity = {
  quantity: number
  total_amount: number
  unit_price: number
}

export type OrderMetadata = {
  customer_name: string
  last_split_amount: number
  last_split_customer_id: string
  last_split_customer_name: string
  last_split_payment_id: string
  last_split_quantities: Record<string, LastSplitQuantity>
  last_split_type: string
}

export type OrderItem = {
  id: string
  order_id: string
  product_id: string
  product_name: string
  product_variant_id: string | null
  quantity: number
  unit_price: number
  total_price: number
  modifiers: unknown[] // Adjust if modifiers have a defined structure
  notes: string
  status: string
  created_at: string
  updated_at: string
  printer_type: string
  paid_quantity: number
}

export type PaymentOrderItem = {
  id: string
  payment_id: string
  order_item_id: string
  amount: number
  created_at: string
  updated_at: string
}

export type PaymentMetadata = {
  customer_id: string
  customer_name: string
  split_type: string
}

export type Payment = {
  id: string
  order_id: string
  payment_method_id: string
  payment_method_name: string
  payment_method_type: string
  amount: number
  status: string
  split_number: number
  split_total: number
  split_type: string
  split_description: string
  refund_amount: number
  metadata: PaymentMetadata
  created_at: string
  updated_at: string
  payment_order_items: PaymentOrderItem[]
}

export type Order = {
  id: string
  order_number: string
  outlet_id: string
  user_id: string
  table_number: string
  order_type: string
  status: string
  subtotal: number
  tax_amount: number
  discount_amount: number
  total_amount: number
  total_cost: number
  remaining_amount: number
  payment_status: string
  refund_amount: number
  is_void: boolean
  is_refund: boolean
  notes: string | null
  metadata: OrderMetadata
  created_at: string
  updated_at: string
  order_items: OrderItem[]
  payments: Payment[]
  total_paid: number
  payment_count: number
  split_type: string
}

export type Orders = {
  orders: Order[],
  total_count: number
  page: number
  limit: number
  total_pages: number
}
