<?php

declare(strict_types=1);

namespace SiteFort\Modules\Firewall\Migrations;

use SiteFort\Core\Database\Migration;
use SiteFort\Core\Installer;
use SiteFort\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();
	}
}
