import { createRouter as createTanStackRouter } from '@tanstack/react-router';
// Import the generated route tree
import { routeTree } from './routeTree.gen';

export function createRouter() {
    const router = createTanStackRouter({
        routeTree,
        scrollRestoration: true,
    });
    return router;
}

export function getRouter() {
    return createRouter();
}

// Register the router instance for type safety
declare module '@tanstack/react-router' {
    interface Register {
        router: ReturnType<typeof createRouter>;
    }
}
