<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Employee extends Model
{

    protected $fillable = [
        'user_id', 'superadmin_id', 'company_id', 'branch_id', 'department_id', 'designation_id', 'shift_id', 'policy_id',
        'photo', 'name', 'father_husband_name', 'employee_code', 'enroll_no', 'proximity_card_no', 
        'dob', 'address', 'email', 'mobile_no',
        'date_of_joining', 'shift_start_date', 'resignation_date',
        'shift_type', 'half_day_shift', 'allow_notifications', 'second_wo_days',
        'first_weekly_off', 'second_weekly_off', 'second_wo_type', 'extra_allowances_for_tour', 'is_auto_shift',
        'week_time_zone_1', 'week_time_zone_2', 'week_time_zone_3', 'week_time_zone_4',
        'week_time_zone_5', 'week_time_zone_6', 'week_time_zone_7', 'week_time_zone_8',
        'validity_start', 'validity_end'
    ];

    protected $casts = [
        'second_wo_days' => 'array',
        'is_auto_shift' => 'array',
        'allow_notifications' => 'boolean',
    ];

    public function user() { return $this->belongsTo(User::class); }
    public function company() { return $this->belongsTo(Company::class); }
    public function branch() { return $this->belongsTo(Branch::class); }
    public function department() { return $this->belongsTo(Department::class); }
    public function designation() { return $this->belongsTo(Designation::class); }
    public function policy() { return $this->belongsTo(Policy::class); }
    public function shift() { return $this->belongsTo(Shift::class); }
}
