import { apiDelete, apiGet, apiPatch, apiPost } from './client' import type { ProjectCreate, ProjectListResponse, ProjectRead } from '../../types' export const projectsApi = { list: (options?: { name?: string; limit?: number }): Promise => { const search = new URLSearchParams() if (options?.name) search.set('name', options.name) if (options?.limit) search.set('limit', String(options.limit)) const query = search.toString() return apiGet(`/api/v1/projects${query ? `?${query}` : ''}`) }, create: (payload: ProjectCreate): Promise => apiPost('/api/v1/projects', payload), get: (id: string): Promise => apiGet(`/api/v1/projects/${id}`), update: (id: string, payload: Partial): Promise => apiPatch(`/api/v1/projects/${id}`, payload), delete: (id: string): Promise<{ deleted: boolean }> => apiDelete<{ deleted: boolean }>(`/api/v1/projects/${id}`), }