<?php
/**
 * Deactivator — clears scheduled events but leaves data intact.
 *
 * @package WPLens
 */

namespace WPLens;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

final class Deactivator {

	public static function deactivate(): void {
		$hooks = array(
			'wplens_cron_log_pruner',
			'wplens_cron_citations_run',
			'wplens_cron_weekly_report',
			'wplens_cron_self_health',
		);

		foreach ( $hooks as $hook ) {
			$timestamp = wp_next_scheduled( $hook );
			while ( false !== $timestamp ) {
				wp_unschedule_event( $timestamp, $hook );
				$timestamp = wp_next_scheduled( $hook );
			}
		}

		flush_rewrite_rules();
	}
}
