<?php

namespace App\Enums;

enum CommissionType: string
{
    case Percent = 'percent';
    case Fixed   = 'fixed';

    public function label(): string
    {
        return match ($this) {
            self::Percent => 'Persentase (%)',
            self::Fixed   => 'Nominal Tetap (Rp)',
        };
    }

    public static function forSelect(): array
    {
        return array_map(fn ($case) => [
            'value' => $case->value,
            'label' => $case->label(),
        ], self::cases());
    }
}
