<?php

namespace App\Support\Badges\Domains;

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

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

        return match ($state) {
            'pending' => new BadgeSpec('Pending', 'warning', 'heroicon-m-clock'),
            'active' => new BadgeSpec('Active', 'success', 'heroicon-m-check-circle'),
            'inactive' => new BadgeSpec('Inactive', 'gray', 'heroicon-m-minus-circle'),
            'archived' => new BadgeSpec('Archived', 'gray', 'heroicon-m-minus-circle'),
            'suspended' => new BadgeSpec('Suspended', 'warning', 'heroicon-m-exclamation-triangle'),
            'error' => new BadgeSpec('Error', 'danger', 'heroicon-m-x-circle'),
            default => BadgeSpec::unknown(),
        };
    }
}
