<?php

declare(strict_types=1);

namespace App\Framework\Console\ErrorRecovery;

enum SuggestionReason: string
{
    case EXACT_MATCH = 'exact';
    case PREFIX_MATCH = 'prefix';
    case PARTIAL_MATCH = 'partial';
    case WORD_SIMILARITY = 'words';
    case FUZZY_MATCH = 'fuzzy';

    public function getDisplayText(): string
    {
        return match ($this) {
            self::EXACT_MATCH => 'exact match',
            self::PREFIX_MATCH => 'starts with input',
            self::PARTIAL_MATCH => 'contains input',
            self::WORD_SIMILARITY => 'similar words',
            self::FUZZY_MATCH => 'similar spelling'
        };
    }

    public function getPriority(): int
    {
        return match ($this) {
            self::EXACT_MATCH => 100,
            self::PREFIX_MATCH => 90,
            self::PARTIAL_MATCH => 70,
            self::WORD_SIMILARITY => 60,
            self::FUZZY_MATCH => 40
        };
    }
}
