import api from './api';

const onboardingService = {
    /**
     * Get all onboarding protocols
     */
    getAll: async () => {
        const response = await api.get('/onboarding');
        return response.data.data;
    },

    /**
     * Get onboarding protocol by ID
     */
    getById: async (id) => {
        const response = await api.get(`/onboarding/${id}`);
        return response.data.data;
    },

    /**
     * Create new onboarding protocol
     */
    create: async (protocolData) => {
        const response = await api.post('/onboarding', protocolData);
        return response.data.data;
    },

    /**
     * Update onboarding protocol
     */
    update: async (id, protocolData) => {
        const response = await api.put(`/onboarding/${id}`, protocolData);
        return response.data.data;
    },

    /**
     * Regenerate PDF for onboarding protocol
     */
    regeneratePdf: async (id) => {
        const response = await api.post(`/onboarding/${id}/regenerate-pdf`);
        return response.data.data;
    },

    /**
     * Send confirmation email with PDF to employee
     */
    sendConfirmationEmail: async (id) => {
        const response = await api.post(`/onboarding/${id}/send-confirmation`);
        return response.data;
    },

    /**
     * Delete onboarding protocol
     */
    delete: async (id) => {
        const response = await api.delete(`/onboarding/${id}`);
        return response.data;
    },

    /**
     * Get statistics
     */
    getStatistics: async () => {
        const response = await api.get('/onboarding/stats');
        return response.data.data;
    },

    /**
     * Download PDF
     */
    downloadPdf: (pdfPath) => {
        return `/${pdfPath}`;
    },
};

export default onboardingService;
