export type MilestoneStatus = number; export type CaseMilestoneUpdate = {id: string, orderIndex?: (number | unknown | null) | undefined, status?: (MilestoneStatus | null) | undefined, completedAt?: (string | null) | undefined}; export type BulkUpdateCaseMilestonesRequest = {milestones: Array}; export type CreateApiCaseMilestonesBulkArgs = {caseId?: string | undefined, body: BulkUpdateCaseMilestonesRequest}; export type CreateApiCaseMilestonesBulkOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Bulk update milestones (for reordering/status changes) * * POST /CaseMilestones/bulk */ export const createApiCaseMilestonesBulk = async (args: CreateApiCaseMilestonesBulkArgs, options?: CreateApiCaseMilestonesBulkOptions) => { const {baseUrl = "https://api.clinicos.vet/backend/business", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.caseId != null) query.append("caseId", String(args.caseId)) if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/CaseMilestones/bulk${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };