<?php
/**
 * OVP-Sponsorizare Uninstall
 * Ruleaza la dezinstalarea completa a pluginului (nu la dezactivare).
 *
 * @package OVPSPO_Sponsorizare
 */

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

global $wpdb;

// Sterge tabelele create de plugin
$tables = array(
    $wpdb->prefix . 'f230_submissions',
    $wpdb->prefix . 'f177_submissions',
    $wpdb->prefix . 'contracte_sponsorizare',
);

foreach ( $tables as $table ) {
    $wpdb->query( "DROP TABLE IF EXISTS " . esc_sql( $table ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.PreparedSQL.NotPrepared
}

// Sterge optiunile pluginului
$options = array(
    'ovpspo_settings',
    'ovpspo_tcpdf_status',
    'ovpspo_db_v3',
    'ovpspo_db_v4',
);
foreach ( $options as $opt ) {
    delete_option( $opt );
}
