<?php

declare(strict_types=1);

namespace SecurWP\Modules\Firewall\Migrations;

use SecurWP\Core\Database\Migration;
use SecurWP\Core\Installer;
use SecurWP\Modules\Firewall\FirewallLogger;

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

final class FirewallEventSchemaV1 implements Migration {

	public function module_key(): string {
		return 'firewall';
	}

	public function target_version(): int {
		return 1;
	}

	public function is_applied(): bool {
		return FirewallLogger::is_schema_current();
	}

	public function apply(): bool {
		Installer::ensure_firewall_events_table_schema();
		FirewallLogger::reset_table_state();
		return FirewallLogger::is_schema_current();
	}
}
