import { apiFetch } from "../helpers/fetcher";

const BASE_URL = 'dossierRDVs';

const API_URL = `http://localhost:5000/${BASE_URL}`;

export async function createDossierRDV(id_dossier: string, data: any) {
    const dataResult = await apiFetch(`${API_URL}/${id_dossier}/create`, {
        method: "POST",
        body: JSON.stringify(data)
    });
    return dataResult;
}

export async function updateDossierRDV(id_dossier: string, data: any) {
    const result = await apiFetch(`${API_URL}/${id_dossier}/update`, {
        method: "PATCH",
        body: JSON.stringify(data)
    });
    return result;
}

export async function getDossierRDVs(id_dossier: string) {
    const dataResult = await apiFetch(`${API_URL}/${id_dossier}`);
    return dataResult;
}

export async function getDossierRDVsCount(dataResult: any) {
    return dataResult.length;
}