<?php

declare(strict_types=1);

namespace App\Support\Badges\Domains;

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

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

        return match ($state) {
            DiffRowStatus::Unchanged->value => new BadgeSpec('Unchanged', 'gray', 'heroicon-m-minus-circle'),
            DiffRowStatus::Changed->value => new BadgeSpec('Changed', 'warning', 'heroicon-m-arrow-path'),
            DiffRowStatus::Added->value => new BadgeSpec('Added', 'success', 'heroicon-m-plus-circle'),
            DiffRowStatus::Removed->value => new BadgeSpec('Removed', 'danger', 'heroicon-m-x-circle'),
            default => BadgeSpec::unknown(),
        };
    }
}
