<?php
/**
 * Deactivation routine. Intentionally non-destructive (keeps lead data).
 *
 * @package Leadite
 */

namespace Leadite;

defined( 'ABSPATH' ) || exit;

class Deactivator {

	/**
	 * Run on plugin deactivation.
	 * We do NOT drop tables here — lead data must survive a deactivation.
	 * Table removal happens only in uninstall.php on explicit delete.
	 */
	public static function deactivate() {
		// Clear the daily Pro-status revalidation cron so it does not persist
		// after deactivation.
		wp_clear_scheduled_hook( 'leadite_revalidate_pro' );

		// Clear the auto-purge (data retention) cron.
		wp_clear_scheduled_hook( 'leadite_autopurge_daily' );

		// Clear Follow-Up Guard cron events.
		wp_clear_scheduled_hook( 'leadite_sla_hourly' );
		wp_clear_scheduled_hook( 'leadite_sla_digest' );

		// Clear pending background integrations.
		wp_clear_scheduled_hook( 'leadite_dispatch_telegram' );
		wp_clear_scheduled_hook( 'leadite_dispatch_webhook' );

		flush_rewrite_rules();
	}
}