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

interface DeleteConfirmModalProps {
  open: boolean;
  plateNo: string;
  onCancel: () => void;
  onConfirm: () => void;
}

export function DeleteConfirmModal({ open, plateNo, onCancel, onConfirm }: DeleteConfirmModalProps) {
  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="delete-confirm-title"
        onClick={(e) => e.stopPropagation()}
      >
        <header className="vm-modal-header">
          <h2 id="delete-confirm-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>
          <p className="ldb-confirm-meta">{plateNo ? `车牌：${plateNo}` : ''}</p>
        </div>
        <footer className="vm-modal-footer">
          <button type="button" className="vm-btn vm-btn-ghost" onClick={onCancel}>取消</button>
          <button type="button" className="vm-btn vm-btn-danger" onClick={onConfirm}>确认删除</button>
        </footer>
      </div>
    </div>
  );
}
