import { Route } from "react-router-dom";
import { adminUiPrefix } from "./adminPaths";
import { AdminLayout } from "./layouts/AdminLayout";
import { AdminLogin } from "./pages/admin/AdminLogin";
import { AdminDashboard } from "./pages/admin/AdminDashboard";
import { AdminResources } from "./pages/admin/AdminResources";
import { AdminResourceForm } from "./pages/admin/AdminResourceForm";
import { AdminSearchLogs } from "./pages/admin/AdminSearchLogs";

/** Shared between full `App` (when admin enabled) and `AppAdminOnly`. */
export function AdminRouteTree() {
  return (
    <>
      <Route path={`${adminUiPrefix}/login`} element={<AdminLogin />} />
      <Route path={adminUiPrefix} element={<AdminLayout />}>
        <Route index element={<AdminDashboard />} />
        <Route path="resources" element={<AdminResources />} />
        <Route path="resources/new" element={<AdminResourceForm />} />
        <Route path="resources/:id" element={<AdminResourceForm />} />
        <Route path="search-logs" element={<AdminSearchLogs />} />
      </Route>
    </>
  );
}
