import { API } from '@/api/API';

export const dealerService = {
    getDashboardData: async () => {
        try {
            const response: any = await API.getDealerDashboard();
            return response.data?.data || response.data;
        } catch (error) {
            console.error('Get dealer dashboard error:', error);
            throw error;
        }
    },
    getConstitutionalChanges: async () => {
        try {
            const response: any = await API.getConstitutionalChanges();
            return response.data;
        } catch (error) {
            console.error('Get constitutional changes error:', error);
            throw error;
        }
    },
    submitConstitutionalChange: async (data: any) => {
        try {
            const response: any = await API.createConstitutionalChange(data);
            return response.data;
        } catch (error) {
            console.error('Submit constitutional change error:', error);
            throw error;
        }
    },
    getRelocationRequests: async () => {
        try {
            const response: any = await API.getRelocationRequests();
            return response.data;
        } catch (error) {
            console.error('Get relocation requests error:', error);
            throw error;
        }
    },
    submitRelocationRequest: async (data: any) => {
        try {
            const response: any = await API.createRelocationRequest(data);
            return response.data;
        } catch (error) {
            console.error('Submit relocation request error:', error);
            throw error;
        }
    }
};
