import api from './auth'; import type { Service, ServiceCreate, ServiceUpdate, ServiceHealthCheck } from '../types/service'; export const serviceAPI = { // Get all services getAll: async (): Promise => { const { data } = await api.get('/api/services'); return data; }, // Get service by ID getById: async (id: string): Promise => { const { data } = await api.get(`/api/services/${id}`); return data; }, // Create new service create: async (serviceData: ServiceCreate): Promise => { const { data } = await api.post('/api/services', serviceData); return data; }, // Update service update: async (id: string, serviceData: ServiceUpdate): Promise => { const { data} = await api.put(`/api/services/${id}`, serviceData); return data; }, // Delete service delete: async (id: string): Promise => { await api.delete(`/api/services/${id}`); }, // Check service health checkHealth: async (id: string): Promise => { const { data } = await api.post(`/api/services/${id}/health-check`); return data; }, // Check all services health checkAllHealth: async (): Promise => { const { data } = await api.post('/api/services/health-check/all'); return data; }, };