<?php

declare(strict_types=1);

namespace App\Support\Badges\Domains;

use App\Support\Badges\BadgeCatalog;
use App\Support\Badges\BadgeMapper;
use App\Support\Badges\BadgeSpec;

final class BaselineCompareMatrixStateBadge implements BadgeMapper
{
    public function spec(mixed $value): BadgeSpec
    {
        return match (BadgeCatalog::normalizeState($value)) {
            'match' => new BadgeSpec('Reference aligned', 'success', 'heroicon-m-check-circle'),
            'differ' => new BadgeSpec('Drift detected', 'danger', 'heroicon-m-exclamation-triangle'),
            'missing' => new BadgeSpec('Missing from tenant', 'warning', 'heroicon-m-minus-circle'),
            'ambiguous' => new BadgeSpec('Identity ambiguous', 'info', 'heroicon-m-question-mark-circle'),
            'not_compared' => new BadgeSpec('Not compared', 'gray', 'heroicon-m-clock'),
            'stale_result' => new BadgeSpec('Result stale', 'warning', 'heroicon-m-arrow-path'),
            default => BadgeSpec::unknown(),
        };
    }
}
