import api from './api';

const licenseService = {
    getAll: async () => {
        const response = await api.get('/licenses');
        return response.data.data;
    },

    getById: async (id) => {
        const response = await api.get(`/licenses/${id}`);
        return response.data.data;
    },

    create: async (data) => {
        const response = await api.post('/licenses', data);
        return response.data.data;
    },

    update: async (id, data) => {
        const response = await api.put(`/licenses/${id}`, data);
        return response.data.data;
    },

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

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

    importFromEntra: async () => {
        const response = await api.post('/licenses/import/entra');
        return response.data.data;
    },

    getLicenseUsers: async (id) => {
        const response = await api.get(`/licenses/${id}/users`);
        return response.data.data;
    },
};

export default licenseService;
