<?php

namespace CaptureRelay;

final class Plugin
{
    private static ?self $instance = null;

    public static function instance(): self
    {
        return self::$instance ??= new self();
    }

    public function boot(): void
    {
        Activator::maybeUpgrade();
        Updater::register();
        add_action('rest_api_init', [new RestController(), 'registerRoutes']);
        add_action(Cron::HOOK, [Cron::class, 'cleanup']);

        if (is_admin()) {
            (new Admin())->hooks();
            (new Privacy())->hooks();
        }
    }
}
