<?php

declare(strict_types=1);

namespace Kylin\Hr\Models;

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

/**
 * 简历模型
 *
 * 管理候选人简历信息，包括基本信息、教育经历、工作经历等。
 *
 * @property string $name          姓名
 * @property string $phone         电话
 * @property string $email         邮箱
 * @property string $applied_position 应聘岗位
 */
class Resume extends Model
{
    use SoftDeletes;

    protected $fillable = [
        'recruitment_plan_id',
        'name',
        'phone',
        'email',
        'position_applied',
        'source_channel_id',
        'education',
        'work_years',
        'status',
        'resume_file',
    ];

    protected function casts(): array
    {
        return [
            'work_years' => 'integer',
            'status' => 'integer',
        ];
    }

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

    public function interviews(): HasMany
    {
        return $this->hasMany(Interview::class);
    }
}
