import { createRouter, createRootRoute, createRoute } from '@tanstack/react-router'
import Layout from './components/layout'
import MainPage from './pages/main'
import HomePage from './pages/home'
import RecipePage from './pages/recipe'

// Create a root route with layout
const rootRoute = createRootRoute({
  component: Layout,
})

// Main page route (new landing page)
const indexRoute = createRoute({
  getParentRoute: () => rootRoute,
  path: '/',
  component: MainPage,
})

// Home page route (old content)
const homeRoute = createRoute({
  getParentRoute: () => rootRoute,
  path: '/home',
  component: HomePage,
})

// Recipe page route
const recipeRoute = createRoute({
  getParentRoute: () => rootRoute,
  path: '/recipe',
  component: RecipePage,
})

// Create the router
const router = createRouter({
  routeTree: rootRoute.addChildren([indexRoute, homeRoute, recipeRoute]),
})

export default router