import { api } from "src/boot/axios";
import type { SchedulePreset } from "src/modules/profile/models/schedule-presets.models";

export const SchedulePresetsService = {
    createSchedulePresets: async (new_schedule: SchedulePreset) => {
        const response = await api.post(`/schedule-presets/create/`, new_schedule);
        return response.data;
    },

    updateSchedulePresets: async (preset_id: number, dto: Partial<SchedulePreset>) => {
        const response = await api.patch(`/schedule-presets/update/${preset_id}`, dto);
        return response.data;
    },

    deleteSchedulePresets: async (preset_id: number) => {
        const response = await api.delete(`/schedule-presets/delete/${preset_id}`);
        return response.data;
    },

    findListOfSchedulePresets: async () => {
        const response = await api.get(`/schedule-presets/find-list`);
        return response.data;
    },

    applyPresets: async (preset_name: string, start_date: string) => {
        const response = await api.post(`/schedule-presets/apply-presets/`, { preset: preset_name, start: start_date });
        return response.data;
    },
};