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

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

export function AddUnitDialog({
  isOpen,
  onClose,
  organizationId,
}: UnitDialogProps) {
  const handleSuccess = (unitName: string) => {
    onClose();
  };

  return (
    <Dialog open={isOpen} onOpenChange={(open) => !open && onClose()}>
      <DialogContent className="sm:max-w-[425px]">
        <DialogHeader>
          <DialogTitle>{t("contentManagement.addNewUnit")}</DialogTitle>
        </DialogHeader>
        <AddUnitForm
          organizationId={organizationId}
          onSuccess={handleSuccess}
          onCancel={onClose}
        />
      </DialogContent>
    </Dialog>
  );
}
