<?php

declare(strict_types=1);

namespace App\Support\Badges\Domains;

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

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

        return match ($state) {
            AuditActorType::Human => new BadgeSpec('Human', 'info', 'heroicon-m-user'),
            AuditActorType::System => new BadgeSpec('System', 'gray', 'heroicon-m-cpu-chip'),
            AuditActorType::Scheduled => new BadgeSpec('Scheduled job', 'warning', 'heroicon-m-clock'),
            AuditActorType::Integration => new BadgeSpec('Integration', 'primary', 'heroicon-m-link'),
            AuditActorType::Platform => new BadgeSpec('Platform', 'gray', 'heroicon-m-shield-check'),
        };
    }
}
