<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class EmployeeSalaryLine extends Model
{
    protected $fillable = [
        'employee_id', 'line_type', 'salary_component_id', 'component_name',
        'amount', 'validity', 'qty_per_year', 'sort_order',
    ];

    protected $casts = [
        'amount' => 'decimal:2',
        'qty_per_year' => 'integer',
    ];

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

    public function salaryComponent()
    {
        return $this->belongsTo(PayrollSalaryComponent::class, 'salary_component_id');
    }
}
