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

export interface MyTicket {
  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;
  event?: {
    id: number;
    title: string;
    slug: string;
    start_date: string;
    end_date: string;
    location: string | null;
  };
  ticket_type_name?: string;
}

/** Comprehensive read model powering Detail Ticket + E-Ticket — see TicketDetailResource (backend). */
export interface TicketDetail {
  id: number;
  ticket_code: string;
  status: TicketStatus;
  holder_name: string;
  holder_email: string | null;
  holder_phone: string | null;
  companion_name: string | null;
  ticket_type: {
    id: number;
    name: string;
    price: string;
  };
  order: {
    id: number;
    order_number: string;
    created_at: string;
  };
  payment: Payment | null;
  event: {
    id: number;
    title: string;
    slug: string;
    status: string;
    banner: string | null;
    thumbnail: string | null;
    location: string | null;
    address: string | null;
    start_date: string;
    end_date: string;
    organizer_name: string;
    // Not in the schema yet — always null today, rendered conditionally.
    gate: string | null;
    zone: string | null;
  };
  qr: { token: string; status: string } | null;
}

export interface TicketDownload {
  ticket_code: string;
  holder_name: string;
  status: TicketStatus;
  event: {
    title: string;
    start_date: string;
    location: string | null;
  };
  qr: { token: string; status: string } | null;
}
