<?php

namespace App\Support\Badges\Domains;

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

final class FindingStatusBadge implements BadgeMapper
{
    public function spec(mixed $value): BadgeSpec
    {
        $state = BadgeCatalog::normalizeState($value);

        return match ($state) {
            Finding::STATUS_NEW => new BadgeSpec('New', 'warning', 'heroicon-m-clock'),
            Finding::STATUS_ACKNOWLEDGED => new BadgeSpec('Acknowledged', 'gray', 'heroicon-m-check-circle'),
            default => BadgeSpec::unknown(),
        };
    }
}
