<?php
declare(strict_types=1);

namespace App\Modules\HR\Models;

use App\Core\Model;

class HrSalaryComponent extends Model
{
    protected static string $table = 'hr_salary_components';
    protected static string $primaryKey = 'id';
    protected static bool $timestamps = true;
    protected static bool $softDelete = false;
    protected static bool $autoTrackAuthor = true;

    protected static array $fillable = [
        'structure_id', 'component_code', 'name_ar', 'name_en', 'type',
        'calculation_type', 'default_amount', 'percentage_of', 'percentage_value',
        'is_taxable', 'is_insurable', 'is_basic', 'is_variable',
        'is_system_calculated', 'is_mandatory', 'affects_overtime',
        'sort_order', 'is_active',
    ];

    public static function getCalculationTypes(): array
    {
        return [
            'fixed'                => 'مبلغ ثابت',
            'percentage_of_basic'  => 'نسبة من الأساسي',
            'percentage_of_gross'  => 'نسبة من الإجمالي',
            'formula'              => 'معادلة (يحسبها النظام)',
        ];
    }

    public static function getTypes(): array
    {
        return [
            'earning'   => 'استحقاق',
            'deduction' => 'استقطاع',
        ];
    }
}
