<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;

class QuestionAnswers extends Model
{
    use HasFactory;

    protected $fillable = [
        'question_id',
        'user_id',
        'survey_id',
        'answer_id',
        'answer_type',
        'answer',
        'updated_at',
    ];

    public function questionSurveys(): BelongsTo
    {
        return $this->belongsTo(QuestionSurveys::class, 'question_id', 'id');
    }

    public function users(): HasOne
    {
        return $this->hasOne(User::class, 'id', 'user_id');
    }
}
