<?php

namespace App\Models\Hr;

use App\Models\User;
use App\Traits\BelongsToStore;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class EmployeeProfile extends Model
{
    use BelongsToStore;

    protected $fillable = [
        'store_id', 'user_id', 'employee_no', 'hire_date', 'birth_date',
        'gender', 'id_card', 'education', 'emergency_contact', 'emergency_phone',
        'base_salary', 'position_salary', 'status', 'left_date',
    ];

    protected function casts(): array
    {
        return [
            'hire_date' => 'date',
            'birth_date' => 'date',
            'left_date' => 'date',
            'gender' => 'integer',
            'status' => 'integer',
            'base_salary' => 'decimal:2',
            'position_salary' => 'decimal:2',
        ];
    }

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