import { apiFetch } from "@/lib/auth/api-client"; import { CreateOptions, idempotencyHeaders } from "@/lib/offline/idempotency"; import { CreateFeedingInput, Feeding, FeedingSummaryEntry, UpdateFeedingInput, } from "./types"; export function fetchColonyFeedings(colonyId: string): Promise { return apiFetch(`/colonies/${colonyId}/feedings`); } export function fetchColonyFeedingsSummary(colonyId: string): Promise { return apiFetch(`/colonies/${colonyId}/feedings/summary`); } export function createFeeding( input: CreateFeedingInput, options: CreateOptions = {}, ): Promise { return apiFetch("/feedings", { method: "POST", headers: idempotencyHeaders(options), body: JSON.stringify(input), }); } export function updateFeeding( id: string, input: UpdateFeedingInput, ): Promise { return apiFetch(`/feedings/${id}`, { method: "PATCH", body: JSON.stringify(input), }); }