import type { Court, CreateCourtInput, UpdateCourtInput } from '@repo/api-contract';
import { http } from '../http';

export async function listByComplex(complexId: string) {
  const response = await http.get<Court[]>(`/api/courts/complex/${complexId}`);
  return response.data;
}

export async function create(complexId: string, payload: CreateCourtInput) {
  const response = await http.post<Court>(`/api/courts/complex/${complexId}`, payload);
  return response.data;
}

export async function update(id: string, payload: UpdateCourtInput) {
  const response = await http.patch<Court>(`/api/courts/${id}`, payload);
  return response.data;
}
