<?php

declare(strict_types=1);

namespace App\Support\Badges\Domains;

use App\Services\Workspaces\WorkspaceLifecycleService;
use App\Support\Badges\BadgeCatalog;
use App\Support\Badges\BadgeMapper;
use App\Support\Badges\BadgeSpec;

final class WorkspaceClosurePostureBadge implements BadgeMapper
{
    public function spec(mixed $value): BadgeSpec
    {
        return match (BadgeCatalog::normalizeState($value)) {
            WorkspaceLifecycleService::WORKSPACE_POSTURE_OPEN => new BadgeSpec('Open', 'success', 'heroicon-m-check-circle'),
            WorkspaceLifecycleService::WORKSPACE_POSTURE_CLOSED => new BadgeSpec('Closed', 'danger', 'heroicon-m-lock-closed'),
            default => BadgeSpec::unknown(),
        };
    }
}
