import React from "react";
import { createBrowserRouter } from "react-router";
import { Layout } from "./components/Layout";
import { PrivateRoute } from "./components/PrivateRoute";
import { LoginPage } from "./pages/LoginPage";
import { RegisterPage } from "./pages/RegisterPage";
import { Dashboard } from "./pages/Dashboard";
import { NewProject } from "./pages/NewProject";
import { StyleSelection } from "./pages/StyleSelection";
import { OutlineGeneration } from "./pages/OutlineGeneration";
import { EpisodeGeneration } from "./pages/EpisodeGeneration";
import { CharacterGeneration } from "./pages/CharacterGeneration";
import { SceneGeneration } from "./pages/SceneGeneration";
import { PropsGeneration } from "./pages/PropsGeneration";
import { StoryboardWorkspace } from "./pages/StoryboardWorkspace";
import { VideoGeneration } from "./pages/VideoGeneration";
import { ProjectSettings } from "./pages/ProjectSettings";
import { ProjectDetail } from "./pages/ProjectDetail";
import { AssetsManagement } from "./pages/AssetsManagement";
import { TeamManagement } from "./pages/TeamManagement";
import { UsageManagement } from "./pages/UsageManagement";
import { AIWatermarkSettings } from "./pages/AIWatermarkSettings";
import { ModelSettings } from "./pages/ModelSettings";
import { AgentStudio } from "./pages/AgentStudio";

export const router = createBrowserRouter([
  { path: "/login", element: <LoginPage /> },
  { path: "/register", element: <RegisterPage /> },
  {
    path: "/",
    element: (
      <PrivateRoute>
        <Layout />
      </PrivateRoute>
    ),
    children: [
      { index: true, element: <Dashboard /> },
      { path: "new-project", element: <NewProject /> },
      { path: "team", element: <TeamManagement /> },
      { path: "usage", element: <UsageManagement /> },
      { path: "settings", element: <AIWatermarkSettings /> },
      { path: "models", element: <ModelSettings /> },
      { path: "assets/*", element: <AssetsManagement /> },
      { path: "project/:projectId", element: <ProjectDetail /> },
      { path: "project/:projectId/style", element: <StyleSelection /> },
      { path: "project/:projectId/outline", element: <OutlineGeneration /> },
      { path: "project/:projectId/episodes", element: <EpisodeGeneration /> },
      { path: "project/:projectId/characters", element: <CharacterGeneration /> },
      { path: "project/:projectId/scenes", element: <SceneGeneration /> },
      { path: "project/:projectId/props", element: <PropsGeneration /> },
      { path: "project/:projectId/storyboard/:episodeId?", element: <StoryboardWorkspace /> },
      { path: "project/:projectId/video", element: <VideoGeneration /> },
      { path: "project/:projectId/settings", element: <ProjectSettings /> },
      { path: "project/:projectId/agent", element: <AgentStudio /> },
    ],
  },
]);
