<?php

namespace App\Domain\Inventory\Enums;

enum MovementType: string
{
    case PurchaseReceived = 'purchase_received';
    case Sale = 'sale';
    case TransferOut = 'transfer_out';
    case TransferIn = 'transfer_in';
    case ReturnToStock = 'return_to_stock';
    case ReturnToSupplier = 'return_to_supplier';
    case AdjustmentUp = 'adjustment_up';
    case AdjustmentDown = 'adjustment_down';
    case Damage = 'damage';
    case Loss = 'loss';
    case Consumption = 'consumption';
    case KitAssembly = 'kit_assembly';
    case KitDisassembly = 'kit_disassembly';
    case InitialStock = 'initial_stock';
    case CountAdjustmentUp = 'count_adjustment_up';
    case CountAdjustmentDown = 'count_adjustment_down';

    public function direction(): string
    {
        return match ($this) {
            self::PurchaseReceived, self::TransferIn, self::ReturnToStock,
            self::AdjustmentUp, self::KitDisassembly, self::InitialStock,
            self::CountAdjustmentUp => 'in',

            self::Sale, self::TransferOut, self::ReturnToSupplier,
            self::AdjustmentDown, self::Damage, self::Loss,
            self::Consumption, self::KitAssembly, self::CountAdjustmentDown => 'out',
        };
    }

    public function label(): string
    {
        return match ($this) {
            self::PurchaseReceived => 'استلام مشتريات',
            self::Sale => 'بيع',
            self::TransferOut => 'تحويل صادر',
            self::TransferIn => 'تحويل وارد',
            self::ReturnToStock => 'إرجاع للمخزن',
            self::ReturnToSupplier => 'إرجاع للمورد',
            self::AdjustmentUp => 'تسوية بالزيادة',
            self::AdjustmentDown => 'تسوية بالنقص',
            self::Damage => 'تالف',
            self::Loss => 'فقد',
            self::Consumption => 'استهلاك',
            self::KitAssembly => 'تجميع طقم',
            self::KitDisassembly => 'تفكيك طقم',
            self::InitialStock => 'رصيد افتتاحي',
            self::CountAdjustmentUp => 'تسوية جرد بالزيادة',
            self::CountAdjustmentDown => 'تسوية جرد بالنقص',
        };
    }
}
