<?php

namespace App\Support;

class VoucherPaymentMethods
{
    /** @return array<string, string> */
    public static function options(): array
    {
        return [
            'cheque' => 'Cheque',
            'beftn' => 'BEFTN',
            'rtgs' => 'RTGS',
            'npsb' => 'NPSB',
            'pay_order' => 'Pay Order',
            'tt' => 'TT',
            'dd' => 'DD',
            'other' => 'Other',
        ];
    }

    public static function appliesTo(string $voucherType): bool
    {
        return in_array($voucherType, ['bank_payment', 'contra'], true);
    }

    public static function label(?string $key): ?string
    {
        if ($key === null || $key === '') {
            return null;
        }

        return self::options()[$key] ?? null;
    }
}
