<?php

namespace App\Support\Badges\Domains;

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

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

        return match ($state) {
            'true', '1', 'yes', 'enabled' => new BadgeSpec('Enabled', 'success', 'heroicon-m-check-circle'),
            'false', '0', 'no', 'disabled' => new BadgeSpec('Disabled', 'gray', 'heroicon-m-minus-circle'),
            default => BadgeSpec::unknown(),
        };
    }
}
