interface ConfirmDisableDialogProps {
    ruleName: string;
    message: string;
    onCancel: () => void;
    onConfirm: () => void;
    loading?: boolean;
}

export function ConfirmDisableDialog({
    ruleName,
    message,
    onCancel,
    onConfirm,
    loading = false,
}: ConfirmDisableDialogProps) {
    return (
        <div
            className="fixed inset-0 z-50 flex items-center justify-center bg-slate-950/75 p-4 backdrop-blur-sm"
            role="dialog"
            aria-modal="true"
            aria-labelledby="confirm-disable-title"
        >
            <div className="w-full max-w-md rounded-2xl border border-slate-800 bg-slate-900 p-6 shadow-2xl">
                <h3 id="confirm-disable-title" className="text-lg font-bold text-white">
                    Disable {ruleName}?
                </h3>
                <p className="mt-3 text-sm leading-relaxed text-slate-400">{message}</p>
                <div className="mt-6 flex justify-end gap-3">
                    <button
                        type="button"
                        onClick={onCancel}
                        disabled={loading}
                        className="rounded-xl border border-slate-700 px-4 py-2 text-sm font-semibold text-slate-300 transition hover:bg-slate-800 disabled:opacity-50"
                    >
                        Cancel
                    </button>
                    <button
                        type="button"
                        onClick={onConfirm}
                        disabled={loading}
                        className="rounded-xl border border-rose-500/30 bg-rose-500/10 px-4 py-2 text-sm font-semibold text-rose-300 transition hover:bg-rose-500/20 disabled:opacity-50"
                    >
                        Disable Anyway
                    </button>
                </div>
            </div>
        </div>
    );
}

export const DISABLE_WARNING_MESSAGES: Record<string, string> = {
    xml_rpc: 'This may expose your site to XML-RPC brute-force attacks and pingback abuse. Only disable if a trusted application requires XML-RPC.',
    rest_api: 'Attackers may discover valid usernames through the REST API, making password attacks easier.',
    login_protection: 'Your login page will be more vulnerable to automated password guessing.',
    admin_protection: 'Admin access restrictions will be removed for this website.',
    file_editor: 'Compromised admin accounts could edit theme or plugin files directly from WordPress.',
    file_modification: 'Plugins and themes could be installed or changed from the dashboard without extra controls.',
    upload_protection: 'Uploaded PHP files in the media folder may become executable — a common malware technique.',
    pingback_trackback: 'Legacy pingback features may be abused for DDoS reflection attacks.',
    user_enumeration: 'Attackers can scan for valid usernames using author archives and similar tricks.',
    directory_listing: 'Visitors may see folder contents when index files are missing, leaking file names and structure.',
    deactivation_protection: 'The security agent could be deactivated without additional approval.',
    brute_force_protection: 'Repeated login attempts will no longer be throttled on this website.',
    ip_blocking: 'Known malicious IPs may reach your site without automatic blocking.',
    malware_scanner: 'Malware may go undetected without scheduled file scans.',
    file_integrity_monitor: 'Changes to WordPress core files may not be reported.',
    plugin_whitelist: 'Any plugin could be installed without whitelist enforcement.',
    emergency_lock: 'Emergency lockdown capabilities will be unavailable for this module.',
};
