/**
 * Guard Dog Admin Settings JavaScript
 * Handles admin interface interactions
 */

(function($) {
    'use strict';

    $(document).ready(function() {
        // Handle clear debug log button confirmation
        $('.guard-dog-clear-log-btn').on('click', function(e) {
            if (!confirm(guard_dog_admin_settings.clearLogConfirm)) {
                e.preventDefault();
                return false;
            }
        });

        // Handle clear all logs button confirmation
        $('.guard-dog-clear-all-logs-btn').on('click', function(e) {
            if (!confirm(guard_dog_admin_settings.clearAllLogsConfirm)) {
                e.preventDefault();
                return false;
            }
        });

        // Handle clear logs button confirmation
        $('.guard-dog-clear-logs-btn').on('click', function(e) {
            if (!confirm(guard_dog_admin_settings.clearLogsConfirm)) {
                e.preventDefault();
                return false;
            }
        });

        // Handle reset lockouts button confirmation
        $('.guard-dog-reset-lockouts-btn').on('click', function(e) {
            if (!confirm(guard_dog_admin_settings.resetLockoutsConfirm)) {
                e.preventDefault();
                return false;
            }
        });

        // Handle reset all settings button confirmation
        $('.guard-dog-reset-all-settings-btn').on('click', function(e) {
            if (!confirm(guard_dog_admin_settings.resetAllSettingsConfirm)) {
                e.preventDefault();
                return false;
            }
        });

        // Handle dismiss health check button
        $('.guard-dog-dismiss-health-check').on('click', function() {
            $(this).closest('.guard-dog-health-check-results').hide();
        });

        // Handle temporary access confirmations
        $('.guard-dog-revoke-user-btn').on('click', function(e) {
            if (!confirm(guard_dog_admin_settings.revokeUserConfirm)) {
                e.preventDefault();
                return false;
            }
        });

        $('.guard-dog-delete-expired-user-btn').on('click', function(e) {
            if (!confirm(guard_dog_admin_settings.deleteExpiredUserConfirm)) {
                e.preventDefault();
                return false;
            }
        });

        // Handle unlock IP button confirmation
        $('.guard-dog-unlock-ip-btn').on('click', function(e) {
            if (!confirm(guard_dog_admin_settings.unlockIpConfirm)) {
                e.preventDefault();
                return false;
            }
        });
    });

})(jQuery);
