import AgentForm from "./components/agents/AgentForm";
import AgentList from "./components/agents/AgentList";
import { BrowserRouter, Routes, Route, Navigate } from "react-router-dom";
import AppLayout from "./components/layout/AppLayout";
import ProjectForm from "./components/projects/ProjectForm";
import ProjectDashboard from "./components/projects/ProjectDashboard";
import SettingsPage from "./components/settings/SettingsPage";
import TicketDetail from "./components/tickets/TicketDetail";
import TicketList from "./components/tickets/TicketList";
import TrackerConfig from "./components/trackers/TrackerConfig";

function EmptyState() {
  return (
    <div className="flex items-center justify-center h-full text-gray-400">
      <p>Select a project or create a new one</p>
    </div>
  );
}

function App() {
  return (
    <BrowserRouter>
      <Routes>
        <Route element={<AppLayout />}>
          <Route index element={<EmptyState />} />
          <Route path="/projects/new" element={<ProjectForm />} />
          <Route path="/projects/:projectId" element={<ProjectDashboard />} />
          <Route path="/projects/:projectId/tickets" element={<TicketList />} />
          <Route path="/projects/:projectId/edit" element={<ProjectForm />} />
          <Route path="/projects/:projectId/trackers/new" element={<TrackerConfig />} />
          <Route path="/projects/:projectId/trackers/:trackerConfigId/edit" element={<TrackerConfig />} />
          <Route path="/agents" element={<AgentList />} />
          <Route path="/agents/new" element={<AgentForm />} />
          <Route path="/agents/:agentId/edit" element={<AgentForm />} />
          <Route path="/tickets/:ticketId" element={<TicketDetail />} />
          <Route path="/settings" element={<SettingsPage />} />
          <Route path="*" element={<Navigate to="/" replace />} />
        </Route>
      </Routes>
    </BrowserRouter>
  );
}

export default App;
