<?php

namespace WPSN\Cli;

use WPSN\Core\Container;

defined('ABSPATH') || exit;

/**
 * WP-CLI integration.
 */
final class CliKernel
{
    private Container $container;

    public function __construct(Container $container)
    {
        $this->container = $container;
    }

    public function register(): void
    {
        if (!defined('WP_CLI') || !(bool) WP_CLI || !class_exists('WP_CLI')) {
            return;
        }

        // Register under: wp wpsn ...
        \WP_CLI::add_command('wpsn queue', new QueueCommand($this->container));
        \WP_CLI::add_command('wpsn audit', new AuditCommand($this->container));
        \WP_CLI::add_command('wpsn smoke', new SmokeCommand($this->container));
        \WP_CLI::add_command('wpsn platform', new PlatformCommand($this->container));
    }
}
