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

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

export function AddSubDepartmentDialog({
  isOpen,
  onClose,
  departmentId,
  organizationId,
  unitId,
  departmentName,
}: SubDepartmentDialogProps) {
  const handleSuccess = (subDepartmentName: string) => {
    onClose();
  };

  return (
    <Dialog open={isOpen} onOpenChange={(open) => !open && onClose()}>
      <DialogContent className="sm:max-w-[425px]">
        <DialogHeader>
          <DialogTitle>Add New Sub-Department</DialogTitle>
        </DialogHeader>
        <AddSubDepartmentForm
          departmentId={departmentId}
          departmentName={departmentName}
          organizationId={organizationId}
          unitId={unitId}
          onSuccess={handleSuccess}
          onCancel={onClose}
        />
      </DialogContent>
    </Dialog>
  );
}
