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

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

export async function fetchContact(id) {
  return get(`/api/contact/${id}`);
}

export async function createContact(data) {
  return post('/api/contact', data);
}

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

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