import React from "react";
import {
  Dialog,
  DialogContent,
  DialogHeader,
  DialogTitle,
  DialogFooter,
} from "@/shared/common/ui/dialog";
import { Button } from "@/shared/common/ui/button";

interface DynamicModalProps {
  open: boolean;
  onClose: () => void;
  onConfirm: () => void;
  renderContent: React.ReactNode;
  confirmButtonText?: string;
  cancelButtonText?: string;
}

const DynamicModal: React.FC<DynamicModalProps> = ({
  open,
  onClose,
  onConfirm,
  renderContent,
  confirmButtonText = "OK",
  cancelButtonText = "Cancel",
}) => {
  return (
    <Dialog open={open} onOpenChange={onClose}>
      <DialogContent>
        <DialogHeader>
          <DialogTitle>Modal</DialogTitle>
        </DialogHeader>
        {renderContent}
        <DialogFooter>
          <Button variant="outline" onClick={onClose}>
            {cancelButtonText}
          </Button>
          <Button onClick={onConfirm}>{confirmButtonText}</Button>
        </DialogFooter>
      </DialogContent>
    </Dialog>
  );
};

export default DynamicModal;
