<?php

namespace WPSN\Modules\SchemaValidator;

use WPSN\Core\AbstractModule;
use WPSN\Modules\SchemaValidator\Admin\SchemaValidatorAdmin;
use WPSN\Modules\SchemaValidator\SchemaValidatorJobs;

defined('ABSPATH') || exit;

/**
 * Schema Validator module.
 *
 * Roadmap: Schema validator & recommendations.
 */
final class SchemaValidatorModule extends AbstractModule
{
    public function id(): string
    {
        return 'schema_validator';
    }

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

    public function description(): string
    {
        return __('Validate structured data output and get actionable recommendations.', 'wp-seo-next');
    }

    public function defaultEnabled(): bool
    {
        // Admin tool.
        return true;
    }

    public function register(): void
    {
        add_action('init', [SchemaValidatorInstaller::class, 'maybeInstall'], 1);

        // Queue jobs (schema scan without admin-ajax).
        (new SchemaValidatorJobs($this->container))->register();

        if (is_admin()) {
            (new SchemaValidatorAdmin($this->container))->register();
        }
    }
}
