<?php
/**
 * Uninstall script for Profit Warden.
 *
 * Runs when the plugin is deleted from the WordPress admin.
 * Removes all plugin options and scheduled cron events.
 *
 * @package ProfitWarden
 */

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

// Remove plugin settings.
delete_option( 'profwabr_settings' );

// Remove all transients set by the plugin.
delete_transient( 'profwabr_activation_redirect' );

// Unschedule cron events.
$profwabr_timestamp = wp_next_scheduled( 'profwabr_periodic_report_event' );
if ( $profwabr_timestamp ) {
    wp_unschedule_event( $profwabr_timestamp, 'profwabr_periodic_report_event' );
}
wp_clear_scheduled_hook( 'profwabr_periodic_report_event' );
