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

interface AddFromSubCityDialogProps {
  isOpen: boolean;
  onClose: () => void;
  parentUnitId: string;
}

export function AddFromSubCityDialog({
  isOpen,
  onClose,
  parentUnitId,
}: AddFromSubCityDialogProps) {
  return (
    <Dialog open={isOpen} onOpenChange={(open) => !open && onClose()}>
      <DialogContent className="sm:max-w-[480px] max-w-[calc(100vw-2rem)] overflow-hidden">
        <DialogHeader>
          <DialogTitle className="truncate">
            {t("contentManagement.addFromSubCity", "Add From Sub City")}
          </DialogTitle>
        </DialogHeader>
        <div className="min-w-0">
          <AddFromSubCityForm
            parentUnitId={parentUnitId}
            onSuccess={onClose}
            onCancel={onClose}
          />
        </div>
      </DialogContent>
    </Dialog>
  );
}
