<?php
/**
 * Internal bootstrap for the Polanger Firewall addon.
 *
 * @package Polanger_Dashboard_Tools
 */

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

if ( ! defined( 'PDT_FIREWALL_VERSION' ) ) {
  define( 'PDT_FIREWALL_VERSION', defined( 'PDT_VERSION' ) ? PDT_VERSION : '1.5.6' );
}

if ( ! defined( 'PDT_FIREWALL_DIR' ) ) {
  define( 'PDT_FIREWALL_DIR', trailingslashit( __DIR__ ) );
}

if ( ! defined( 'PDT_FIREWALL_URL' ) ) {
  define( 'PDT_FIREWALL_URL', trailingslashit( plugins_url( 'addons/firewall', PDT_PLUGIN_FILE ) ) );
}

if ( ! defined( 'PDT_FIREWALL_ADDON_SLUG' ) ) {
  define( 'PDT_FIREWALL_ADDON_SLUG', 'firewall' );
}

require_once PDT_FIREWALL_DIR . 'includes/class-firewall-settings.php';
require_once PDT_FIREWALL_DIR . 'includes/class-firewall-logger.php';
require_once PDT_FIREWALL_DIR . 'includes/class-firewall-runtime.php';
require_once PDT_FIREWALL_DIR . 'diagnostics/class-firewall-diagnostics.php';
require_once PDT_FIREWALL_DIR . 'includes/class-firewall-page.php';

/**
 * Suite-native firewall addon bootstrapper.
 */
class PDT_Firewall_Addon {

  /**
   * Settings service.
   *
   * @var PDT_Firewall_Settings
   */
  private $settings;

  /**
   * Logger service.
   *
   * @var PDT_Firewall_Logger
   */
  private $logger;

  /**
   * Boot the bundled Firewall module.
   */
  public function __construct() {
    $this->settings = new PDT_Firewall_Settings();
    $this->logger   = new PDT_Firewall_Logger();

    $diagnostics = new PDT_Firewall_Diagnostics( $this->settings, $this->logger );
    $page = new PDT_Firewall_Page( $this->settings, $this->logger, $diagnostics );
    $page->register_hooks();
    $diagnostics->register_hooks();

    $runtime = new PDT_Firewall_Runtime( $this->settings, $this->logger );
    $runtime->register_hooks();
  }
}
