export type TicketStatus = "pending" | "paid" | "checked_in" | "expired" | "cancelled";
export type PaymentStatus =
  | "pending"
  | "settlement"
  | "capture"
  | "expire"
  | "cancel"
  | "deny"
  | "refunded";
export type OrderStatus = "pending" | "settlement" | "capture" | "expire" | "cancel" | "deny";

export interface OrderTicket {
  id: number;
  ticket_code: string;
  holder_name: string;
  /** Set only for package ticket types (e.g. "Piknik") — the second person sharing this QR. */
  companion_name?: string | null;
  status: TicketStatus;
}

export interface OrderItem {
  id: number;
  ticket_type: { id: number; name: string };
  quantity: number;
  price_at_purchase: string;
  subtotal: string;
  tickets: OrderTicket[];
}

export type PaymentMethod = "qris" | "bank_transfer";
export type VaBank = "bca" | "bni" | "bri" | "permata";

export interface Payment {
  id: number;
  payment_method: string | null;
  bank: string | null;
  va_number: string | null;
  qr_url: string | null;
  expiry_time: string | null;
  status: PaymentStatus;
  gross_amount: string;
  paid_at: string | null;
}

export interface Order {
  id: number;
  order_number: string;
  holder_name: string;
  holder_email: string;
  subtotal: string;
  discount_amount: string;
  platform_fee: string;
  admin_fee: string;
  tax_amount: string;
  total_amount: string;
  status: OrderStatus;
  promo: { code: string; discount_percentage: number } | null;
  voucher: { code: string; discount_amount: string } | null;
  items: OrderItem[];
  payments: Payment[];
  created_at: string;
}

/** Response shape of POST /checkout/quote — the single source every checkout summary UI renders from. */
export interface PricingBreakdown {
  subtotal: string;
  discount: string;
  discounted_subtotal: string;
  platform_fee: string;
  admin_fee: string;
  admin_fee_percent: number;
  tax: string;
  tax_percent: number;
  total: string;
}
