<?php
/**
 * Uninstall script for WebAbility Accessibility Widget
 * 
 * This file runs when the plugin is deleted (not just deactivated)
 */

// If uninstall not called from WordPress, then exit
if (!defined('WP_UNINSTALL_PLUGIN')) {
    exit;
}

// Delete plugin options
delete_option('webability_options');
delete_option('webability_scan_results');
delete_option('webability_scan_meta');
delete_option('webability_scans');
delete_option('webability_theme_fixes');
delete_option('webability_fix_backups');
delete_option('webability_acwg_statement');
delete_option('webability_acwg_statement_page_id');
delete_option('webability_verified');

// For multisite installations
if (is_multisite()) {
    $sites = get_sites(array(
        'number' => 0, // Get all sites
        'fields' => 'ids'
    ));

    foreach ($sites as $site_id) {
        switch_to_blog($site_id);
        delete_option('webability_options');
        delete_option('webability_scan_results');
        delete_option('webability_scan_meta');
        delete_option('webability_scans');
        delete_option('webability_theme_fixes');
        delete_option('webability_fix_backups');
        delete_option('webability_acwg_statement');
        delete_option('webability_acwg_statement_page_id');
        delete_option('webability_verified');
        restore_current_blog();
    }
}

// Note: We don't delete user data here as it might be intentional to keep settings
// Users can manually clean database if needed
