<?php
if (!defined('WP_UNINSTALL_PLUGIN')) {
    exit;
}

global $wpdb;
$gamadsmbai_table_main = $wpdb->prefix . 'gamadsmbai_ads';
/** @noinspection SqlResolve */
/** @noinspection SqlNoDataSourceInspection */
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.DirectDatabaseQuery.SchemaChange,PluginCheck.Security.DirectDB.UnescapedDBParameter -- $table is derived from $wpdb->prefix and escaped; safe internal schema operation
$wpdb->query("DROP TABLE IF EXISTS $gamadsmbai_table_main");
$gamadsmbai_table_adunits = $wpdb->prefix . 'gamadsmbai_adunits';
/** @noinspection SqlResolve */
/** @noinspection SqlNoDataSourceInspection */
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.DirectDatabaseQuery.SchemaChange,PluginCheck.Security.DirectDB.UnescapedDBParameter -- $table is derived from $wpdb->prefix and escaped; safe internal schema operation
$wpdb->query("DROP TABLE IF EXISTS $gamadsmbai_table_adunits");

// Delete All Keys
delete_option('gam_web_client_id');
delete_option('gam_web_client_secret');
delete_option('gam_redirect_uri');
delete_option('gam_using_default_config');
delete_option('gam_secret_iv');
delete_option('gam_ads_ad_manager_and_ad_exchange_tokens');
delete_option('gam_ads_ad_manager_and_ad_exchange_networks');
delete_option('gam_ads_ad_manager_and_ad_exchange_network_code');
