<?php

namespace App\Models\Interview;

use App\Traits\BelongsToTenant;
use App\Traits\ModelTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class InterviewSession extends Model
{
    use BelongsToTenant, ModelTrait, SoftDeletes;

    protected $fillable = [
        'tenant_id',
        'interview_category_id',
        'interviewer_id',
        'interviewee_name',
        'interviewee_company',
        'interview_date',
        'status',
        'total_questions',
        'answered_questions',
        'memo',
        'completed_at',
        'created_by',
        'updated_by',
        'deleted_by',
    ];

    protected $casts = [
        'interview_date' => 'date',
        'completed_at' => 'datetime',
        'total_questions' => 'integer',
        'answered_questions' => 'integer',
    ];

    public function category()
    {
        return $this->belongsTo(InterviewCategory::class, 'interview_category_id');
    }

    public function interviewer()
    {
        return $this->belongsTo(\App\Models\User::class, 'interviewer_id');
    }

    public function answers()
    {
        return $this->hasMany(InterviewAnswer::class, 'interview_session_id');
    }
}
