<?php

namespace App\Models;

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

class Interview extends Model
{
    protected $fillable = [
        'application_id',
        'job_post_id',
        'recruiter_id',
        'applicant_id',
        'interview_date',
        'interview_time',
        'location',
        'interview_type',
        'notes',
        'status',
        'feedback',
    ];

    protected function casts(): array
    {
        return [
            'interview_date' => 'datetime',
        ];
    }

    /**
     * Get the application that the interview belongs to.
     */
    public function application(): BelongsTo
    {
        return $this->belongsTo(Application::class);
    }

    /**
     * Get the job post.
     */
    public function jobPost(): BelongsTo
    {
        return $this->belongsTo(JobPost::class);
    }

    /**
     * Get the recruiter.
     */
    public function recruiter(): BelongsTo
    {
        return $this->belongsTo(RecruiterProfile::class, 'recruiter_id');
    }

    /**
     * Get the applicant.
     */
    public function applicant(): BelongsTo
    {
        return $this->belongsTo(User::class, 'applicant_id');
    }
}
