import apiClient from "@/api/client";

export interface Doctor {
	doctorId: string;
	name: string;
	designation?: string;
	workingStatus?: string;
	qualification?: string;

	departments: {
		departmentId: string;
		timing?: {
			monday?: string;
			tuesday?: string;
			wednesday?: string;
			thursday?: string;
			friday?: string;
			saturday?: string;
			sunday?: string;
			additional?: string;
		};
	}[];
}

export const getDoctorsApi = async () => {
	const res = await apiClient.get("/doctors/getAll");
	return res.data;
};

export const getDoctorByIdApi = async (doctorId: string) => {
	const res = await apiClient.get(`/doctors/${doctorId}`);
	return res.data;
};

export const createDoctorApi = async (data: Doctor) => {
	const res = await apiClient.post("/doctors", data);
	return res.data;
};

export const updateDoctorApi = async (
	doctorId: string,
	data: Partial<Doctor>,
) => {
	const res = await apiClient.patch(`/doctors/${doctorId}`, data);
	return res.data;
};

export const deleteDoctorApi = async (doctorId: string) => {
	const res = await apiClient.delete(`/doctors/${doctorId}`);
	return res.data;
};

export const getDoctorTimingApi = async (doctorId: string) => {
	const res = await apiClient.get(`/doctors/getTimings/${doctorId}`);
	return res.data;
};
