"use client";

import { useEffect } from "react";
import { useRouter, useSearchParams } from "next/navigation";
import { AppShell } from "@/components/app/AppShell";
import { PageContentSkeleton } from "@/components/ui/Skeleton";

/** مسیر قدیمی — ظرفیت در مراحل قوانین هر پایه تنظیم می‌شود. */
export default function SeatQuotasRedirectPage() {
  const router = useRouter();
  const searchParams = useSearchParams();
  const branchId = searchParams.get("branchId");

  useEffect(() => {
    const q = branchId ? `?branchId=${branchId}` : "";
    router.replace(`/pre-registration/grades${q}`);
  }, [branchId, router]);

  return (
    <AppShell title="ظرفیت پذیرش" subtitle="در حال انتقال به قوانین پایه…">
      <PageContentSkeleton rows={2} />
    </AppShell>
  );
}
