"use client";
import CreateTransferTeamForm from "@/components/forms/transfer-team/team/new/CreateTransferTeamForm";
import Loader from "@/components/Loader";
import SectionTitle from "@/components/SectionTitle";
import {useGetAllTransferTeamAllMembers} from "@/hooks/transfer-team";
import Link from "next/link";
import {useRouter} from "next/navigation";
import React, {Suspense} from "react";

export default function Page() {
  const {data: members, isLoading: fetchMembersLoading} =
    useGetAllTransferTeamAllMembers();
  const router = useRouter();
  return (
    <section>
      <div className="flex items-center justify-between mb-10">
        <SectionTitle label="فرم افزودن تیم جدید" />
        <Link
          href={`/transfer-team/teams`}
          className="text-sm bg-primary px-4 py-2 rounded-lg text-white"
        >
          مشاهده لیست تیم ها
        </Link>
      </div>
      <Suspense fallback={<Loader />}>
        {members && (
          <CreateTransferTeamForm
            router={router}
            fetchMembersLoading={fetchMembersLoading}
            fetchPackagesLoading={false}
            packages={[]}
            members={members}
          />
        )}
      </Suspense>
    </section>
  );
}
