<?php

namespace App\Enums;

use Filament\Support\Contracts\HasColor;
use Filament\Support\Contracts\HasLabel;

enum CreditLedgerEntryType: string implements HasColor, HasLabel
{
    case FREE_GRANT = 'free_grant';
    case PURCHASE = 'purchase';
    case SUBSCRIPTION_RENEWAL = 'subscription_renewal';
    case USAGE = 'usage';
    case REFUND = 'refund';
    case ADJUSTMENT = 'adjustment';

    public function getLabel(): string
    {
        return match ($this) {
            self::FREE_GRANT => __('enums.credit_ledger_entry_type.free_grant'),
            self::PURCHASE => __('enums.credit_ledger_entry_type.purchase'),
            self::SUBSCRIPTION_RENEWAL => __('enums.credit_ledger_entry_type.subscription_renewal'),
            self::USAGE => __('enums.credit_ledger_entry_type.usage'),
            self::REFUND => __('enums.credit_ledger_entry_type.refund'),
            self::ADJUSTMENT => __('enums.credit_ledger_entry_type.adjustment'),
        };
    }

    public function getColor(): string
    {
        return match ($this) {
            self::FREE_GRANT, self::PURCHASE, self::SUBSCRIPTION_RENEWAL => 'success',
            self::USAGE => 'warning',
            self::REFUND => 'info',
            self::ADJUSTMENT => 'gray',
        };
    }
}
