import HeaderCardsSection from "../../Components/EduClass/EduClassHeaderSection";
import TablePage from "../subject/Table/TablePage";
import { usePage_titleState } from "../../zustand/PageTitleState";
import { FaPlus } from "react-icons/fa";
import AddModalForm from "./Model/add/AddModel";
import SendNotificationModalForm from "./Model/SendNotificationCourseModel";
import DeleteModalForm from "../Course/Model/Delete";
import { ModalEnum } from "../../enums/Model";
import useModalHandler from "../../utils/useModalHandler";
import AddSubjectModalForm from "../subject/Model/AddModel";
import EditSubjectModalForm from "../subject/Model/EditModel";
import DeleteSubjectModalForm from "../subject/Model/Delete";
import { hasAbility } from "../../utils/hasAbility";
import { ABILITIES_ENUM, ABILITIES_VALUES_ENUM } from "../../enums/abilities";
// import useSetPage_title from "../../Hooks/useSetPageTitle";
import { useTranslation } from "react-i18next";
import DeleteModels from "../../Layout/Dashboard/DeleteModels";
import { useDeleteCourse } from "../../api/course";
const Page = () => {
  const { title } = usePage_titleState((state) => state);
  const { handel_open_model } = useModalHandler();

  const [t] = useTranslation();
  // useSetPage_title(
  //   `${t(ABILITIES_ENUM?.MAIN_PAGE)}  / ${t(`models.${ABILITIES_ENUM.COURSE}`)} / ${t(`models.${ABILITIES_ENUM.EDUCATION_CLASS}`)}`,
  // );

  const store_subject_ability = hasAbility(
    ABILITIES_ENUM?.SUBJECT,
    ABILITIES_VALUES_ENUM?.STORE,
  );

  const deleteMutation = useDeleteCourse();

  return (
    <div className="EduClass">
      <HeaderCardsSection />
      <div className="TableWithHeader">
        <header>
          <h4 className="Bold Primary ">{t("models.subject")}</h4>
          {store_subject_ability && (
            <button
              onClick={() => handel_open_model(ModalEnum?.SUBJECT_ADD)}
              className="add_button"
            >
              {t("practical.add")} {t("models.subject")} <FaPlus />
            </button>
          )}
        </header>
        <TablePage />
      </div>
      <AddModalForm />
      <SendNotificationModalForm />
      <DeleteModalForm />
      <AddSubjectModalForm />
      <EditSubjectModalForm />
      <DeleteSubjectModalForm />
    </div>
  );
};

export default Page;
