<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Salary extends Model
{
    protected $fillable = [
        'employee_id',
        'month',
        'year',
        'working_days',
        'lop_days',
        'base_salary',
        'hra',
        'special_allowance',
        'conveyance',
        'medical',
        'lta',
        'special_allowance_2',
        'gross_earnings',
        'esic_employee',
        'esic_employer',
        'gratuity',
        'prof_tax',
        'income_tax',
        'gross_deductions',
        'expense_reimbursements',
        'net_pay',
        'bonus',
        'deductions',
        'net_salary',
        'status',
        'payment_date',
        'designation',
        'department',
        'employee_code',
        'notes',
        'components',
    ];

    protected $casts = [
        'components' => 'array',
        'payment_date' => 'datetime',
    ];


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

    public function salaryDeductions()
    {
        return $this->hasMany(SalaryDeduction::class);
    }
}
