import { apiGet, apiPost } from "@/app/lib/clientApi"; import type { AdminEvent, AdminEventCreatePayload, AdminEventUpdatePayload, PickupOutletRow, } from "@/app/lib/types"; // Client-side wrappers for the Events BFF routes (/api/events*), which forward // to mobile-api's /api/admin/events*. Mirrors app/lib/services/adminWarehouses.ts. // All date fields are ISO-8601 strings — no integer-array handling. /** List all events. */ export async function listEvents(): Promise { return apiGet("/api/events"); } /** Fetch one event by id. */ export async function getEvent(id: string): Promise { return apiGet(`/api/events/${id}`); } /** Create a new event. `code` is only writable on create. */ export async function createEvent(input: AdminEventCreatePayload): Promise { return apiPost("/api/events", input); } /** Update an existing event. `code` and `warehouseId` are read-only after creation. */ export async function updateEvent(id: string, input: AdminEventUpdatePayload): Promise { return apiPost(`/api/events/${id}`, input); } /** Pickup outlets offered as an event's pickup point. */ export async function listPickupOutlets(): Promise { return apiGet("/api/events/pickup-outlets"); }