<?php
/**
 * Plugin deactivation handler.
 *
 * @package SuiteMkt3k
 */

namespace SuiteMkt3k;

defined( 'ABSPATH' ) || exit;

final class Deactivator {

	public static function deactivate(): void {
		foreach (
			array(
				'suitemkt3k_cron_5min',
				'suitemkt3k_cron_15min',
				'suitemkt3k_cron_hourly',
				'suitemkt3k_cron_daily',
				'suitemkt3k_send_newsletter_batch',
			) as $hook
		) {
			$timestamp = wp_next_scheduled( $hook );
			while ( $timestamp ) {
				wp_unschedule_event( $timestamp, $hook );
				$timestamp = wp_next_scheduled( $hook );
			}
		}
		flush_rewrite_rules();
	}
}
