/*
 * 주최자용 참가업체 관리 실 API 클라이언트 (#41 · SCR /exhibitors).
 * 정본: 백엔드 com.zioinfo.kintex.exhibitor (ExhibitorController) 시그니처.
 * GET /api/events/{eventId}/exhibitors → ExhibitorList (요약 + 로스터).
 * RBAC: 주최자·홀매니저만(서버 재검증). 금액·상태는 서버 계산 권위 — 프론트는 표시만.
 */
import { api } from '../../api/client';

export type SaleStatus = 'sold' | 'held' | 'available';
export type DesignStatus = 'approved' | 'review' | 'draft' | 'rejected';
export type InvoiceStatus = 'pending' | 'invoiced' | 'paid' | 'overdue' | 'cancelled';

export interface ExhibitorRow {
  boothId: string;
  companyName: string;
  boothNo: string | null;
  boothType: string | null;
  areaM2: number | null;
  saleStatus: SaleStatus | null;
  designStatus: DesignStatus | null;
  invoiceStatus: InvoiceStatus | null;
  outstanding: number;
  contactName: string | null;
  contactPhone: string | null;
}

export interface ExhibitorSummary {
  total: number;
  contracted: number;
  designApproved: number;
  settlementPaid: number;
  outstandingCount: number;
}

export interface ExhibitorList {
  eventId: string;
  eventName: string;
  summary: ExhibitorSummary;
  exhibitors: ExhibitorRow[];
}

export const exhibitorsApi = {
  list: (eventId: string) =>
    api.get<ExhibitorList>(`/api/events/${encodeURIComponent(eventId)}/exhibitors`),
};
