export interface EventCategory {
  id: number;
  name: string;
  slug: string;
}

/** Sale phase (Early Bird/Presale 1-3/Regular Sale/custom) — child of a TicketType category. */
export interface TicketPhase {
  id: number;
  ticket_type_id: number;
  name: string;
  price: string;
  quota: number | null;
  sale_start_date: string;
  sale_end_date: string;
  /** null = no per-phase limit (BR-012's global 3/account cap has been removed). */
  purchase_limit: number | null;
  status: "available" | "sold_out" | "closed" | "coming_soon";
}

/** Ticket category (e.g. "Picnic"/"Festival") — top level of the Category > Phase hierarchy. */
export interface TicketType {
  id: number;
  event_id: number;
  name: string;
  /** Package tickets (e.g. "Piknik" = 2 people sharing one QR) — always 1 or 2. */
  people_per_ticket: number;
  /** Admin-editable terms specific to this ticket type, one bullet per entry (e.g. "1 tiket = 2 orang"). */
  terms: string[];
  phases?: TicketPhase[];
}

export interface EventTheme {
  accent_color: "primary" | "secondary" | "tertiary" | "neutral_dark" | "neutral_white";
  hero_layout: "standard" | "immersive";
}

export interface EventGalleryImage {
  id: number;
  image_path: string;
  order: number;
}

/** Signature Event's dedicated page content — only meaningful when is_signature_event is true. */
export interface SignatureProfile {
  project_title: string | null;
  project_description: string | null;
  project_thumbnail_url: string | null;
  detail_thumbnail_url: string | null;
  /** Main Event Signaturee ink brush reveal "before"/"after" pair — null until admin uploads (frontend falls back to bundled static defaults). */
  main_event_before_url: string | null;
  main_event_after_url: string | null;
  /** Admin toggle: overlay the Signaturee logo+tagline centered on the Main Event thumbnail. */
  main_event_show_logo: boolean;
  /** /detail page's own "Tentang Event" copy — independent from events.description (used by the main event page). */
  about_text: string | null;
  /** Event rules, one bullet point per entry. */
  rules: string[];
  /** Venue map image, uploaded by Administrator — falls back to a default static asset when null. */
  denah_image_url: string | null;
  /** Per-section show/hide toggles for the public Signature page (SignatureEventPage.tsx) — Hero is not included, it's not a standalone toggleable section. */
  show_about: boolean;
  show_venue_date: boolean;
  show_event_card: boolean;
  show_lineup: boolean;
  show_project: boolean;
  show_brand: boolean;
  show_documentation: boolean;
}

export interface SignatureArtist {
  id: number;
  name: string;
  role: string | null;
  display_order: number;
  photo_url: string | null;
}

export interface SignatureBrandPartner {
  id: number;
  name: string;
  logo_url: string | null;
  display_order: number;
}

export interface KolaboraEvent {
  id: number;
  title: string;
  slug: string;
  description: string | null;
  location: string | null;
  address: string | null;
  gmaps_url: string | null;
  start_date: string;
  end_date: string;
  thumbnail: string | null;
  banner: string | null;
  status: "draft" | "waiting_review" | "published" | "ongoing" | "finished" | "rejected" | "suspended";
  /** FR-121/122/123. */
  meta_title?: string | null;
  meta_description?: string | null;
  og_image?: string | null;
  is_signature_event?: boolean;
  theme?: EventTheme | null;
  signature_profile?: SignatureProfile | null;
  signature_artists?: SignatureArtist[];
  signature_brand_partners?: SignatureBrandPartner[];
  /** FR-010: only present when fetched with `sort=popular`. */
  tickets_sold?: number;
  category: EventCategory | null;
  organizer?: { id: number; name: string };
  ticket_types?: TicketType[];
  galleries?: EventGalleryImage[];
  reviewed_at: string | null;
  created_at: string;
  updated_at: string;
}

export interface PaginatedResponse<T> {
  data: T[];
  links: {
    first: string | null;
    last: string | null;
    prev: string | null;
    next: string | null;
  };
  meta: {
    current_page: number;
    last_page: number;
    total: number;
    per_page: number;
  };
}
