import { Router } from 'express';
import {
    // Districts
    getDistricts,
    getAreas,
    createDistrict,
    updateLocation,
    deleteLocation,
    // Regions
    getRegions,
    createRegion,
    updateRegion,
    // Zones
    getZones,
    createZone,
    updateZone,
    // States
    getStates,
    createState,
    // Managers
    getManagersByRole,
    getAreaManagers,
    getASMs,
    getZonalManagers,
    saveZM,
    getDDLeads,
    saveDDLead,
    getSystemConfigs,
    saveSystemConfig,
    getDealerAsmMappings,
    saveDealerAsmMapping,
    getSlaConfigs,
    saveSlaConfig,
    initializeDefaultSlas
} from './master.controller.js';

import {
    getInterviewConfigByType,
    getInterviewConfigs,
    getInterviewConfigById,
    createInterviewConfig,
    updateInterviewConfig,
    deleteInterviewConfig,
    initializeDefaultInterviewConfigs
} from './interviewConfig.controller.js';


const router = Router();

// --- Districts ---
router.get('/districts', getDistricts);
router.post('/districts', createDistrict);
router.put('/districts/:id', updateLocation);
router.delete('/districts/:id', deleteLocation);

// --- Areas ---
router.get('/areas', getAreas);
router.post('/areas', createDistrict);
router.put('/areas/:id', updateLocation);
router.delete('/areas/:id', deleteLocation);

// --- Regions ---
router.get('/regions', getRegions);
router.post('/regions', createRegion);
router.put('/regions/:id', updateRegion);

// --- Zones ---
router.get('/zones', getZones);
router.post('/zones', createZone);
router.put('/zones/:id', updateZone);

// --- States ---
router.get('/states', getStates);
router.post('/states', createState);

// --- Managers ---
router.get('/managers', getManagersByRole);
router.get('/area-managers', getAreaManagers);
router.get('/asms', getASMs);
router.get('/zonal-managers', getZonalManagers);
router.post('/zonal-managers', saveZM);
router.get('/dd-leads', getDDLeads);
router.post('/dd-leads', saveDDLead);
router.get('/system-configs', getSystemConfigs);
router.post('/system-configs', saveSystemConfig);
router.get('/dealer-asm-mappings', getDealerAsmMappings);
router.post('/dealer-asm-mappings', saveDealerAsmMapping);

// --- SLA Configuration ---
router.get('/sla-configs', getSlaConfigs);
router.post('/sla-configs', saveSlaConfig);
router.post('/sla-configs/initialize', initializeDefaultSlas);

// --- Interview Configurations (KT Matrix, Level 2, Level 3 Feedback) ---
router.get('/interview-configs', getInterviewConfigs);
router.get('/interview-configs/active/:configType', getInterviewConfigByType);
router.get('/interview-configs/:id', getInterviewConfigById);
router.post('/interview-configs', createInterviewConfig);
router.put('/interview-configs/:id', updateInterviewConfig);
router.delete('/interview-configs/:id', deleteInterviewConfig);
router.post('/interview-configs/initialize', initializeDefaultInterviewConfigs);

export default router;
