<?php
// Uninstall all saved entries created by game if uninstalling as a fallback for data removal assurance.
defined('ABSPATH') or die('No!');

if (!defined('WP_UNINSTALL_PLUGIN')) {
    exit();
}

$remove_data = get_option('tarotxhoroscope_remove_data_on_uninstall', false);

if ($remove_data === 'on') {
    // Single site cleanup
    delete_option('tarotxhoroscope_api_key');
    delete_option('tarotxhoroscope_domain');
    delete_option('tarotxhoroscope_chatbox_settings');
    delete_option('tarotxhoroscope_three_card_settings');
    delete_option('tarotxhoroscope_horoscope_settings');
    delete_option('tarotxhoroscope_one_card_settings');
    delete_option('tarotxhoroscope_daily_tarot_settings');
    delete_option('tarotxhoroscope_remove_data_on_uninstall');
    delete_transient('tarotxhoroscope_redirect_to_settings');

    // Multisite cleanup (optional if multisite)
    /*
    if (is_multisite()) {
        global $wpdb;
        $blog_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
        foreach ($blog_ids as $blog_id) {
            switch_to_blog($blog_id);
            delete_option('tarotxhoroscope_api_key');
            delete_option('tarotxhoroscope_domain');
            delete_option('tarotxhoroscope_chatbox_settings');
            delete_option('tarotxhoroscope_three_card_settings');            
            delete_option('tarotxhoroscope_horoscope_settings');
            delete_option('tarotxhoroscope_one_card_settings');
            delete_option('tarotxhoroscope_daily_tarot_settings');
            delete_option('tarotxhoroscope_remove_data_on_uninstall');
            delete_transient('tarotxhoroscope_redirect_to_settings');
            restore_current_blog();
        }
    }
    */
}
