import { DocumentView } from "@/components/documents/DocumentView";
import { DocumentLoader } from "@/context/document/DocumentLoader";
import type { DocumentId } from "@/lib/types";
import { createFileRoute } from "@tanstack/react-router";

export const Route = createFileRoute(
  "/_app/_authenticated/document/$documentId",
)({
  component: RouteComponent,
});

function RouteComponent() {
  const { documentId } = Route.useParams();

  return (
    <DocumentLoader documentId={documentId as DocumentId}>
      <DocumentView documentId={documentId as DocumentId} />
    </DocumentLoader>
  );
}
