<?php

declare(strict_types=1);

namespace App\Business\Inventory\Enums;

enum InventoryBusinessType: string
{
    case OtherStockIn = 'other_stock_in';
    case OtherStockOut = 'other_stock_out';
    case OtherStockInVoid = 'other_stock_in_void';
    case OtherStockOutVoid = 'other_stock_out_void';
    case TransferOut = 'transfer_out';
    case TransferIn = 'transfer_in';
    case TransferOutVoid = 'transfer_out_void';
    case TransferInVoid = 'transfer_in_void';
    case StocktakeGain = 'stocktake_gain';
    case StocktakeLoss = 'stocktake_loss';
    case StocktakeGainVoid = 'stocktake_gain_void';
    case StocktakeLossVoid = 'stocktake_loss_void';
    case PurchaseReceipt = 'purchase_receipt';
    case PurchaseReceiptVoid = 'purchase_receipt_void';
    case PurchaseReturn = 'purchase_return';
    case PurchaseReturnVoid = 'purchase_return_void';
    case SalesOutbound = 'sales_outbound';
    case SalesOutboundVoid = 'sales_outbound_void';
    case SalesReturn = 'sales_return';
    case SalesReturnVoid = 'sales_return_void';

    public function label(): string
    {
        $translationKey = 'dberp.options.inventory_business_type.'.$this->value;
        $label = __($translationKey);

        return $label !== $translationKey ? (string) $label : $this->value;
    }
}
