<?php

declare(strict_types=1);

namespace App\Framework\Core\ValueObjects\Services;

enum EmailValidationLevel: string
{
    case BLOCKED = 'blocked';
    case DISPOSABLE = 'disposable';
    case COMMON = 'common';
    case CORPORATE = 'corporate';
    case UNKNOWN = 'unknown';

    public function getTrustScore(): int
    {
        return match ($this) {
            self::BLOCKED => 0,
            self::DISPOSABLE => 1,
            self::UNKNOWN => 2,
            self::COMMON => 3,
            self::CORPORATE => 4,
        };
    }

    public function getName(): string
    {
        return match ($this) {
            self::BLOCKED => 'Blocked',
            self::DISPOSABLE => 'Disposable',
            self::COMMON => 'Common Provider',
            self::CORPORATE => 'Corporate',
            self::UNKNOWN => 'Unknown',
        };
    }

    public function shouldBlock(): bool
    {
        return $this === self::BLOCKED;
    }

    public function requiresVerification(): bool
    {
        return match ($this) {
            self::BLOCKED, self::DISPOSABLE => true,
            default => false,
        };
    }

    public function isHighTrust(): bool
    {
        return $this->getTrustScore() >= 3;
    }
}
