<?php

declare(strict_types=1);

namespace Kylin\Hr\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * 员工离职模型
 *
 * 管理员工离职申请记录，包括离职类型、原因、审批状态等。
 *
 * @property string $resignation_type 离职类型
 * @property string $reason           离职原因
 * @property string $resignation_date 离职日期
 * @property string $status           审批状态
 */
class EmployeeResignation extends Model
{
    use SoftDeletes;

    protected $fillable = [
        'employee_id',
        'type',
        'reason',
        'apply_date',
        'last_work_date',
        'approval_status',
        'handover_note',
    ];

    protected function casts(): array
    {
        return [
            'apply_date' => 'date',
            'last_work_date' => 'date',
        ];
    }

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