import { Navigate, Route, Routes } from "react-router-dom";
import { AppLayout } from "@/components/layout/AppLayout";
import { PrivateRoute } from "@/components/layout/PrivateRoute";
import { LoginPage } from "@/pages/LoginPage";
import { RegisterPage } from "@/pages/RegisterPage";
import { DashboardPage } from "@/pages/DashboardPage";
import { BreakfastPage } from "@/pages/BreakfastPage";
import { SecondBreakfastPage } from "@/pages/SecondBreakfastPage";
import { LunchPage } from "@/pages/LunchPage";
import { DinnerPage } from "@/pages/DinnerPage";
import { AllMealsPage } from "@/pages/AllMealsPage";
import { ManageMealsPage } from "@/pages/ManageMealsPage";
import { RecipeDetailPage } from "@/pages/RecipeDetailPage";
import { IngredientCatalogPage } from "@/pages/IngredientCatalogPage";
import { DietTrackerPage } from "@/pages/DietTrackerPage";
import { MealPlannerPage } from "@/pages/MealPlannerPage";
import { ShoppingListPage } from "@/pages/ShoppingListPage";
import { DietGeneratorPage } from "@/pages/DietGeneratorPage";
import { RecipeGeneratorPage } from "@/pages/RecipeGeneratorPage";
import { NotFoundPage } from "@/pages/NotFoundPage";

export default function App() {
  return (
    <Routes>
      <Route path="/login" element={<LoginPage />} />
      <Route path="/register" element={<RegisterPage />} />

      <Route
        element={
          <PrivateRoute>
            <AppLayout />
          </PrivateRoute>
        }
      >
        <Route path="/" element={<DashboardPage />} />
        <Route path="/breakfast" element={<BreakfastPage />} />
        <Route path="/second-breakfast" element={<SecondBreakfastPage />} />
        <Route path="/lunch" element={<LunchPage />} />
        <Route path="/dinner" element={<DinnerPage />} />
        <Route path="/all-meals" element={<AllMealsPage />} />
        <Route path="/manage-meals" element={<ManageMealsPage />} />
        <Route path="/ingredients" element={<IngredientCatalogPage />} />
        <Route path="/diet" element={<DietTrackerPage />} />
        <Route path="/meal-planner" element={<MealPlannerPage />} />
        <Route path="/shopping-list" element={<ShoppingListPage />} />
        <Route path="/diet-generator" element={<DietGeneratorPage />} />
        <Route path="/recipe-generator" element={<RecipeGeneratorPage />} />
        <Route path="/recipes/:id" element={<RecipeDetailPage />} />
        <Route path="/404" element={<NotFoundPage />} />
        <Route path="*" element={<Navigate to="/404" replace />} />
      </Route>
    </Routes>
  );
}
