import { get, post, patch, del } from './client.js';

export async function fetchSpecialties(params = {}) {
  const query = new URLSearchParams(params).toString();
  return get(query ? `/api/medicalspecialty?${query}` : '/api/medicalspecialty');
}

export async function fetchSpecialty(id) {
  return get(`/api/medicalspecialty/${id}`);
}

export async function createSpecialty(data) {
  return post('/api/medicalspecialty', data);
}

export async function updateSpecialty(id, data) {
  return patch(`/api/medicalspecialty/${id}`, data);
}

export async function deleteSpecialty(id) {
  return del('/api/medicalspecialty', { body: JSON.stringify({ id }) });
}
