<?php

declare(strict_types=1);

namespace App\Enums;

/**
 * Shared verification lifecycle, used by both account verifications and domain
 * ownership verification so that the two read consistently in the UI.
 */
enum VerificationStatus: string
{
    case Unverified = 'unverified';
    case Pending = 'pending';
    case Verified = 'verified';
    case Failed = 'failed';
    case Expired = 'expired';

    public function isVerified(): bool
    {
        return $this === self::Verified;
    }

    /** Whether a fresh verification attempt may be started from this state. */
    public function canRetry(): bool
    {
        return $this !== self::Pending;
    }

    public function label(): string
    {
        return match ($this) {
            self::Unverified => 'Not verified',
            self::Pending => 'Verification pending',
            self::Verified => 'Verified',
            self::Failed => 'Verification failed',
            self::Expired => 'Verification expired',
        };
    }
}
