// Caminho: services/medicosApi.ts import api from './api'; export interface Doctor { id: any; crm: string; crm_uf: string; [key: string]: any; } export const medicosApi = { list: async (): Promise => { const response = await api.get('/rest/v1/doctors?select=*'); return response.data; }, getById: async (id: string): Promise => { const response = await api.get(`/rest/v1/doctors?id=eq.${id}&select=*`, { headers: { Accept: 'application/vnd.pgrst.object+json' }, }); return response.data; }, create: async (data: Omit): Promise => { const response = await api.post('/rest/v1/doctors', data, { headers: { 'Prefer': 'return=representation' } }); return response.data[0]; }, update: async (id: string, data: Partial): Promise => { const response = await api.patch(`/rest/v1/doctors?id=eq.${id}`, data, { headers: { 'Prefer': 'return=representation' } }); return response.data[0]; }, delete: async (id: string): Promise => { await api.delete(`/rest/v1/doctors?id=eq.${id}`); }, };