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

/** 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>
    </>
  );
}
