// Task Team — Feature Registry
// Each feature is a separate file. Add/remove here to enable/disable.
const features = [
    { name: "media-input", path: "./media-input", prefix: "/api/v1" },
    { name: "gamification", path: "./gamification", prefix: "/api/v1" },
    { name: "templates", path: "./templates", prefix: "/api/v1" },
    { name: "time-tracking", path: "./time-tracking", prefix: "/api/v1" },
    { name: "kanban", path: "./kanban", prefix: "/api/v1" },
    { name: "ai-briefing", path: "./ai-briefing", prefix: "/api/v1" },
    { name: "webhooks-outgoing", path: "./webhooks-outgoing", prefix: "/api/v1" },
    { name: "webauthn", path: "./webauthn", prefix: "/api/v1" },
];

async function registerFeatures(app) {
    for (const f of features) {
        try {
            await app.register(require(f.path), { prefix: f.prefix });
            app.log.info(`Feature loaded: ${f.name}`);
        } catch (e) {
            app.log.warn(`Feature ${f.name} failed to load: ${e.message}`);
        }
    }
}

module.exports = { registerFeatures };
