import { apiDelete, apiGet, apiPost } from "@/app/lib/clientApi"; export interface EventGuest { id: number; name: string; mobileE164: string | null; email: string | null; companyName: string | null; salespersonUserId: number | null; salespersonName: string | null; /** Absent without BO_EVENT_GUESTS. */ token?: string; invitedAt: string; inviteSentCount: number; registeredAt: string | null; attended: boolean; eventLeadUuid: string | null; } export interface GuestInput { name: string; mobile: string; email: string; companyName: string; salespersonUserId?: number; } export interface GuestRejection { index: number; code: string; field: string | null; message: string; } export interface AddGuestsResult { added: number; rejected: GuestRejection[]; } export interface Attendance { invited: number; cap: number | null; registered: number; attended: number; walkIns: number; total: number; capacity: number | null; } const base = (uuid: string) => `/api/events/${encodeURIComponent(uuid)}`; export const listGuests = (uuid: string) => apiGet(`${base(uuid)}/guests`); export const addGuests = (uuid: string, guests: GuestInput[], preview: boolean) => apiPost(`${base(uuid)}/guests${preview ? "?preview=true" : ""}`, { guests }); export const removeGuest = (uuid: string, id: number) => apiDelete(`${base(uuid)}/guests/${id}`); export const sendInvites = (uuid: string, target: { guestIds: number[] } | { allUnsent: true }) => apiPost<{ sent: number; skippedNoEmail: number }>(`${base(uuid)}/guests/send`, target); export const getCheckin = (uuid: string) => apiGet<{ token: string }>(`${base(uuid)}/checkin`); export const getAttendance = (uuid: string) => apiGet(`${base(uuid)}/attendance`);