import apiClient from './client';

interface ClearDbResponse {
  message: string;
}

export const clearDatabase = async (hard: boolean): Promise<ClearDbResponse> => {
  try {
    const response = await apiClient.post<ClearDbResponse>('/admin/cleardb', { hard });
    return response.data;
  } catch (error) {
    console.error('Error calling clearDatabase API:', error);
    // Re-throw the error so the component can handle it
    throw error;
  }
};
