<?php

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

use ReallySimplePlugins\RSS\Core\Services\EmailService;

/**
 * TODO: for now this is temp, will need to be moved into a core approach.
 */
class VulnerabilityEmailNotificationPolicy
{
    private EmailService $emailService;

    public function __construct(EmailService $emailService)
    {
        $this->emailService = $emailService;
    }

    /**
     * Vulnerability emails are either explicitly requested or considered critical.
     *
     * They intentionally do not depend on the general notification toggle.
     */
    public function shouldSend(): bool
    {
        return true;
    }

    /**
     * Has the email address been verified so we actually can send the email notification?
     */
    public function canSend(): bool
    {
        return $this->emailService->isEmailVerified();
    }
}
