import api from './api';

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

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

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

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

    /**
     * Return assets for offboarding
     */
    returnAssets: async (id, assetReturns) => {
        const response = await api.post(`/offboarding/${id}/return-assets`, {
            asset_returns: assetReturns
        });
        return response.data.data;
    },

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

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

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

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

export default offboardingService;
