<?php

namespace ReallySimplePlugins\RSS\Core\Features\Pro\Vulnerability;

use ReallySimplePlugins\RSS\Core\Features\AbstractLoader;
use ReallySimplePlugins\RSS\Core\Managers\FeatureManager;
use ReallySimplePlugins\RSS\Core\Traits\HasAllowlistControl;

/**
 * Determines whether the Pro Vulnerability measures feature should be loaded.
 *
 * @see FeatureManager
 */
final class VulnerabilityLoader extends AbstractLoader
{
    use HasAllowlistControl;

    /**
     * @inheritDoc
     */
    public function isEnabled(): bool
    {
        if (!function_exists('rsssl_get_option')) {
            return false;
        }

        $isVulnerabilityScannerEnabled = rsssl_get_option('enable_vulnerability_scanner', false);

        return $isVulnerabilityScannerEnabled;
    }

    /**
     * @inheritDoc
     */
    public function inScope(): bool
    {
        return $this->adminAccessAllowed();
    }
}
