<?php

namespace App\Models;

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

class Pregunta extends Model
{
    protected $guarded = [];

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

    public function tipo(): BelongsTo
    {
        return $this->belongsTo(PreguntaTipo::class, 'pregunta_tipo_id');
    }

    public function opciones(): HasMany
    {
        return $this->hasMany(PreguntaOpcion::class)->orderBy('orden');
    }

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