import {
  Dialog,
  DialogContent,
  DialogHeader,
  DialogTitle,
} from "@/shared/common/ui/dialog";
import { AddUserUnderDepartmentForm } from "../forms/AddUserUnderDepartmentForm";
import { useTranslation } from "react-i18next";

interface AddUserUnderDepartmentDialogProps {
  isOpen: boolean;
  onClose: () => void;
  unitId: string;
  departmentId: string;
  departmentName: string;
}

export function AddUserUnderDepartmentDialog({
  isOpen,
  onClose,
  unitId,
  departmentId,
  departmentName,
}: AddUserUnderDepartmentDialogProps) {
  const { t } = useTranslation();
  const handleSuccess = () => {
    onClose();
  };

  return (
    <Dialog open={isOpen} onOpenChange={(open) => !open && onClose()}>
      <DialogContent className="sm:max-w-[525px]">
        <DialogHeader>
          <DialogTitle>{t("userRecord.Add User Under Department")}</DialogTitle>
        </DialogHeader>
        <AddUserUnderDepartmentForm
          unitId={unitId}
          departmentId={departmentId}
          departmentName={departmentName}
          onSuccess={handleSuccess}
          onCancel={onClose}
        />
      </DialogContent>
    </Dialog>
  );
}
