import { redirect } from 'next/navigation';
import { getSettings } from '../../../../packages/core/src/infrastructure/services/settings.service.js';
import { DefaultHomePage } from '../../../../packages/core/src/domain/generated/output.js';
export const dynamic = 'force-dynamic';
const HOME_PAGE_ROUTES = {
    [DefaultHomePage.ControlCenter]: '/control-center',
    [DefaultHomePage.Applications]: '/applications',
    [DefaultHomePage.Features]: '/features',
};
export default function RootPage() {
    let destination = '/control-center';
    try {
        const settings = getSettings();
        const page = settings.defaultHomePage ?? DefaultHomePage.ControlCenter;
        destination = HOME_PAGE_ROUTES[page] ?? '/control-center';
    }
    catch {
        // Settings not yet initialised (first run) — fall through to default
    }
    redirect(destination);
}
