import {
  Dialog,
  DialogContent,
  DialogHeader,
  DialogTitle,
} from "@/shared/common/ui/dialog";
import { AddDepartmentForm } from "../forms/AddDepartmentForm";
import { t } from "i18next";

interface DepartmentDialogProps {
  isOpen: boolean;
  onClose: () => void;
  organizationId: string;
  unitId: string;
}

export function AddDepartmentDialog({
  isOpen,
  onClose,
  organizationId,
  unitId,
}: DepartmentDialogProps) {
  const handleSuccess = (departmentName: string) => {
    onClose();
  };
  return (
    <Dialog open={isOpen} onOpenChange={(open) => !open && onClose()}>
      <DialogContent className="sm:max-w-[425px]">
        <DialogHeader>
          <DialogTitle>{t("contentManagement.addDepartment")}</DialogTitle>
        </DialogHeader>
        <AddDepartmentForm
          unitId={unitId}
          organizationId={organizationId}
          onSuccess={handleSuccess}
          onCancel={onClose}
        />
      </DialogContent>
    </Dialog>
  );
}
