import React from 'react';
import { X } from 'lucide-react';

interface DetailDeleteConfirmModalProps {
  open: boolean;
  rowLabel?: string;
  onCancel: () => void;
  onConfirm: () => void;
}

export function DetailDeleteConfirmModal({
  open,
  rowLabel,
  onCancel,
  onConfirm,
}: DetailDeleteConfirmModalProps) {
  if (!open) return null;

  return (
    <div className="vm-modal-backdrop" role="presentation" onClick={onCancel}>
      <div
        className="vm-modal vm-modal-sm"
        role="dialog"
        aria-modal="true"
        aria-labelledby="lbd-delete-title"
        onClick={(event) => event.stopPropagation()}
      >
        <header className="vm-modal-header">
          <h2 id="lbd-delete-title" className="vm-modal-title">确认删除</h2>
          <button type="button" className="vm-modal-close" onClick={onCancel} aria-label="关闭">
            <X size={18} aria-hidden />
          </button>
        </header>
        <div className="vm-modal-body">
          <p className="ldb-confirm-text">删除后该条明细将无法恢复，是否确认删除？</p>
          {rowLabel && <p className="ldb-confirm-meta">{rowLabel}</p>}
        </div>
        <footer className="vm-modal-footer">
          <button type="button" className="vm-btn vm-btn-ghost" onClick={onCancel} data-vm-icon="x">取消</button>
          <button type="button" className="vm-btn vm-btn-danger" onClick={onConfirm} data-vm-icon="trash">确认删除</button>
        </footer>
      </div>
    </div>
  );
}
