<?php

namespace App\Modules\HR\Compensation\Models;

use App\Modules\Admin\Tenancy\Traits\BelongsToTenant;
use App\Modules\HR\Employees\Models\Employee;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class EmployeeCompensationItem extends Model
{
    use BelongsToTenant;

    protected $table = 'hr_employee_compensation_items';

    protected $guarded = ['id'];

    protected function casts(): array
    {
        return [
            'amount' => 'decimal:2', 'percentage' => 'decimal:4',
            'effective_from' => 'date', 'effective_to' => 'date', 'is_active' => 'boolean',
        ];
    }

    public function employee(): BelongsTo
    {
        return $this->belongsTo(Employee::class);
    }
}
