<?php

declare(strict_types=1);

namespace apexl\Io\modules\tabulator\Tabulatable\ColumnCallback;

use apexl\Io\modules\tabulator\Interfaces\HasTabulatorViewInterface;
use apexl\Io\modules\tabulator\Interfaces\TabulatableColumnCallback;

final readonly class EnumValue implements TabulatableColumnCallback
{
    public function __invoke(HasTabulatorViewInterface $entity, string $field): null|int|string
    {
        return $entity->{$field}?->value;
    }
}
