import { Button } from "@/components/ui/button";
import {
  Dialog,
  DialogContent,
  DialogHeader,
  DialogTitle,
  DialogDescription,
  DialogFooter,
} from "@/components/ui/dialog";

interface DeleteSubpageDialogProps {
  open: boolean;
  pageName: string;
  onConfirm: () => void;
  onCancel: () => void;
}

export function DeleteSubpageDialog({
  open,
  pageName,
  onConfirm,
  onCancel,
}: DeleteSubpageDialogProps) {
  return (
    <Dialog
      open={open}
      onOpenChange={(isOpen) => {
        if (!isOpen) onCancel();
      }}
    >
      <DialogContent>
        <DialogHeader>
          <DialogTitle>Delete subpage?</DialogTitle>
          <DialogDescription>
            You removed the link to &ldquo;{pageName}&rdquo;. Do you also want
            to delete the subpage and all its content?
          </DialogDescription>
        </DialogHeader>
        <DialogFooter>
          <Button variant="outline" onClick={onCancel}>
            Keep subpage
          </Button>
          <Button variant="destructive" onClick={onConfirm}>
            Delete subpage
          </Button>
        </DialogFooter>
      </DialogContent>
    </Dialog>
  );
}
