import React from 'react';

export default function ConfirmDialog({
  visible,
  title,
  content,
  note,
  summary,
  onCancel,
  onConfirm,
  cancelText = '取消',
  confirmText = '确认',
}) {
  if (!visible) return null;
  return (
    <div className="dt-modal-overlay" onClick={onCancel}>
      <div className="dt-modal dt-modal--summary" onClick={(e) => e.stopPropagation()}>
        <h3 className="dt-modal-title">{title}</h3>
        {summary ? <div className="dt-modal-summary">{summary}</div> : null}
        {note ? <p className="dt-modal-note">{note}</p> : null}
        {content ? <p className="dt-modal-content">{content}</p> : null}
        <div className="dt-modal-actions">
          <button type="button" className="dt-btn-secondary" onClick={onCancel}>
            {cancelText}
          </button>
          <button type="button" className="dt-btn-primary" onClick={onConfirm}>
            {confirmText}
          </button>
        </div>
      </div>
    </div>
  );
}
