import { apiFetch } from "@/lib/auth/api-client"; import { BottlingBatch, BottlingBatchFilter, CreateBottlingBatchInput, UpdateBottlingBatchInput, } from "./types"; export function fetchBottlingBatches( filter: BottlingBatchFilter = {}, ): Promise { const params = new URLSearchParams(); if (filter.honeyBatchId) params.set("honeyBatchId", filter.honeyBatchId); const query = params.toString(); return apiFetch(`/bottling-batches${query ? `?${query}` : ""}`); } export function fetchBottlingBatch(id: string): Promise { return apiFetch(`/bottling-batches/${id}`); } export function createBottlingBatch( input: CreateBottlingBatchInput, ): Promise { return apiFetch("/bottling-batches", { method: "POST", body: JSON.stringify(input), }); } export function updateBottlingBatch( id: string, input: UpdateBottlingBatchInput, ): Promise { return apiFetch(`/bottling-batches/${id}`, { method: "PATCH", body: JSON.stringify(input), }); } export function deleteBottlingBatch(id: string): Promise<{ id: string }> { return apiFetch<{ id: string }>(`/bottling-batches/${id}`, { method: "DELETE", }); }