const authRouter = require('./auth');
const uploadRouter = require('./upload');
const downloadRouter = require('./download');
const batchUploadRouter = require('./batchUpload');
const groupsRouter = require('./groups');
const socialMediaRouter = require('./socialMedia');
const migrationRouter = require('./migration');
const reorderRouter = require('./reorder');
const adminRouter = require('./admin');
const consentRouter = require('./consent');
const managementRouter = require('./management');

// Import route mappings (Single Source of Truth!)
const routeMappingsConfig = require('./routeMappings');

// Map router names to actual router instances
const routerMap = {
    auth: authRouter,
    upload: uploadRouter,
    download: downloadRouter,
    batchUpload: batchUploadRouter,
    groups: groupsRouter,
    socialMedia: socialMediaRouter,
    migration: migrationRouter,
    reorder: reorderRouter,
    admin: adminRouter,
    consent: consentRouter,
    management: managementRouter
};

const renderRoutes = (app) => {
    routeMappingsConfig.forEach(({ router, prefix }) => {
        app.use(prefix, routerMap[router]);
    });
};

module.exports = { renderRoutes };