<?php

declare(strict_types=1);

use App\Support\Badges\BadgeCatalog;
use App\Support\Badges\BadgeDomain;

it('maps every canonical tenant lifecycle to an explicit badge', function (string $input, string $label, string $color): void {
    $spec = BadgeCatalog::spec(BadgeDomain::TenantStatus, $input);

    expect($spec->label)->toBe($label)
        ->and($spec->color)->toBe($color);
})->with([
    'draft' => ['draft', 'Draft', 'gray'],
    'onboarding' => ['onboarding', 'Onboarding', 'warning'],
    'active' => ['active', 'Active', 'success'],
    'archived' => ['archived', 'Archived', 'gray'],
]);

it('uses explicit invalid lifecycle fallback for non-canonical tenant lifecycle values', function (): void {
    $pending = BadgeCatalog::spec(BadgeDomain::TenantStatus, 'PENDING');
    $inactive = BadgeCatalog::spec(BadgeDomain::TenantStatus, 'inactive');

    expect($pending->label)->toBe('Invalid lifecycle')
        ->and($pending->color)->toBe('danger')
        ->and($inactive->label)->toBe('Invalid lifecycle')
        ->and($inactive->color)->toBe('danger');
});
