<?php

namespace Modules\Inventory\Enums;

enum UnitTypeEnum: string
{
    case Base = 'Base';
    case Sale = 'Sale';
    case Packaging = 'Packaging';
    case Service = 'Service';

    public const BASE = self::Base->value;
    public const SALE = self::Sale->value;
    public const PACKAGING = self::Packaging->value;
    public const SERVICE = self::Service->value;

    public static function casesAsArray(): array
    {
        return array_map(fn(self $case) => $case->value, self::cases());
    }

    public function label(): string
    {
        return match ($this) {
            self::Base => 'Base Unit',
            self::Sale => 'Sale Unit',
            self::Packaging => 'Packaging Unit',
            self::Service => 'Service Unit',
        };
    }
}
