<?php
/**
 * Plugin deactivator.
 *
 * @package KwiroAISalesAgent
 */

defined( 'ABSPATH' ) || exit;

/**
 * Class Kwiro_Deactivator
 *
 * Handles plugin deactivation: clear CRON events and transients.
 * Note: Options are NOT removed on deactivation (only on uninstall).
 */
class Kwiro_Deactivator {

	/**
	 * Run deactivation routine.
	 */
	public static function deactivate() {
		self::clear_cron_events();
		self::clear_transients();
	}

	/**
	 * Clear all scheduled CRON events.
	 */
	public static function clear_cron_events() {
		wp_unschedule_hook( 'kwiro_batch_sync' );
		wp_unschedule_hook( 'kwiro_weekly_full_sync' );
	}

	/**
	 * Clear plugin transients.
	 */
	public static function clear_transients() {
		delete_transient( 'kwiro_activated' );
		delete_transient( 'kwiro_connection_status' );
		delete_transient( 'kwiro_sync_progress' );
		delete_transient( 'kwiro_sync_lock' );
	}
}
