import type { OrderStatus, PaymentStatus, TicketStatus } from "@/types/order";

export const ORDER_STATUS_LABEL: Record<OrderStatus, string> = {
  pending: "Awaiting Payment",
  settlement: "Payment Successful",
  capture: "Payment Successful",
  expire: "Expired",
  cancel: "Cancelled",
  deny: "Rejected",
};

export const TICKET_STATUS_LABEL: Record<TicketStatus, string> = {
  pending: "Awaiting Payment",
  paid: "Active",
  checked_in: "Checked In",
  expired: "Expired",
  cancelled: "Cancelled",
};

/** Payment status pill on Detail Ticket — collapses Midtrans's 7 raw statuses to the 4 the spec asks for. */
export const PAYMENT_STATUS_LABEL: Record<PaymentStatus, string> = {
  pending: "Pending",
  settlement: "Paid",
  capture: "Paid",
  expire: "Failed",
  cancel: "Failed",
  deny: "Failed",
  refunded: "Refunded",
};

/** QR status pill on the E-Ticket page — maps QrCodeStatus (backend enum) to the spec's VALID/USED/EXPIRED/INVALID. */
export const QR_STATUS_LABEL: Record<string, string> = {
  valid: "VALID",
  already_used: "USED",
  expired: "EXPIRED",
  cancelled: "INVALID",
};

export const EVENT_STATUS_LABEL: Record<string, string> = {
  draft: "Draft",
  waiting_review: "Awaiting Review",
  published: "Coming Soon",
  ongoing: "Ongoing",
  finished: "Finished",
  rejected: "Rejected",
  suspended: "Suspended",
};

export const CHECKIN_NOTE_LABEL: Record<string, string> = {
  already_used: "QR code has already been used",
  wrong_event: "QR code does not belong to this event",
  expired: "QR code has expired",
  cancelled: "Ticket has been cancelled",
  payment_failed: "Payment not yet successful",
  event_finished: "This event has finished",
  event_not_active: "Event is not active (not yet published, or unpublished)",
};
