<?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\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOne;

class QuestionSurveys extends Model
{
    use HasFactory;

    protected $fillable = [
        'survey_id',
        'name',
        'type',
        'status',
        'updated_at',
    ];

    public function surveys(): BelongsTo
    {
        return $this->belongsTo(Surveys::class, 'id', 'survey_id');
    }

    public function questionDetails(): HasOne
    {
        return $this->hasOne(QuestionDetails::class, 'question_id', 'id');
    }

    public function questionAnswers(): HasMany
    {
        return $this->hasMany(QuestionAnswers::class, 'question_id', 'id');
    }
}
