<?php

namespace WPSN\Modules\Diagnostics;

use WPSN\Core\AbstractModule;
use WPSN\Modules\Diagnostics\Admin\DiagnosticsAdmin;
use WPSN\Modules\Diagnostics\Admin\AjaxInventoryAdmin;
use WPSN\Modules\Diagnostics\Admin\QueueAdmin;
use WPSN\Modules\Diagnostics\Admin\QualityGateAdmin;
use WPSN\Modules\Diagnostics\Admin\PlatformOpsAdmin;
use WPSN\Modules\Diagnostics\SiteHealthTests;

defined('ABSPATH') || exit;

/**
 * Diagnostics / Compatibility matrix.
 *
 * Purpose:
 * - give agencies/support a single place to see what's detected/active
 * - provide a safe exportable report (without secrets)
 * - highlight common integration + performance gotchas
 */
final class DiagnosticsModule extends AbstractModule
{
    public function id(): string
    {
        return 'diagnostics';
    }

    public function name(): string
    {
        return __('Diagnostics', 'wp-seo-next');
    }

    public function description(): string
    {
        return __('Compatibility matrix + performance snapshot (support/agency friendly).', 'wp-seo-next');
    }

    public function defaultEnabled(): bool
    {
        return true;
    }

    public function register(): void
    {
        // Scheduled Quality Gate runs (cron tick). Safe to register on both frontend and wp-admin.
        (new QualityGateAutomation($this->container))->register();
        (new PlatformOpsAutomation($this->container))->register();

        if (is_admin()) {
            (new DiagnosticsAdmin($this->container))->register();
            (new AjaxInventoryAdmin($this->container))->register();
            (new QualityGateAdmin($this->container))->register();
            (new QueueAdmin($this->container))->register();
            (new PlatformOpsAdmin($this->container))->register();
        }
    }
}
