<?php

namespace App\Domain\HR\Enums;

enum PayslipItemType: string
{
    case BaseSalary = 'base_salary';
    case SessionPay = 'session_pay';
    case GroupPay = 'group_pay';
    case PlayerPay = 'player_pay';
    case RevenueShare = 'revenue_share';
    case Overtime = 'overtime';
    case Substitute = 'substitute';
    case Bonus = 'bonus';
    case Penalty = 'penalty';
    case AdvanceDeduction = 'advance_deduction';
    case Tax = 'tax';
    case Insurance = 'insurance';
    case OtherDeduction = 'other_deduction';
    case CancelledSessionPay = 'cancelled_session_pay';

    public function isDeduction(): bool
    {
        return in_array($this, [
            self::Penalty,
            self::AdvanceDeduction,
            self::Tax,
            self::Insurance,
            self::OtherDeduction,
        ]);
    }

    public function label(): string
    {
        return match($this) {
            self::BaseSalary => 'الراتب الأساسي',
            self::SessionPay => 'أجر الحصص',
            self::GroupPay => 'أجر المجموعات',
            self::PlayerPay => 'أجر اللاعبين',
            self::RevenueShare => 'حصة الإيرادات',
            self::Overtime => 'العمل الإضافي',
            self::Substitute => 'حصص بديلة',
            self::Bonus => 'مكافآت',
            self::Penalty => 'خصومات',
            self::AdvanceDeduction => 'قسط سلفة',
            self::Tax => 'ضرائب',
            self::Insurance => 'تأمينات',
            self::OtherDeduction => 'خصومات أخرى',
            self::CancelledSessionPay => 'حصص ملغاة',
        };
    }
}
