<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Quiz extends Model
{
    protected $fillable = [
        'training_class_id',
        'title',
        'description',
        'duration_minutes',
        'max_score',
        'pass_score',
        'attempt_limit',
        'status',
        'start_date',
        'end_date',
    ];

    public function trainingClass()
    {
        return $this->belongsTo(TrainingClass::class);
    }

    public function questions()
    {
        return $this->hasMany(QuizQuestion::class)
            ->orderBy('sort_order');
    }

    public function attempts()
    {
        return $this->hasMany(QuizAttempt::class);
    }

    public function blueprints()
    {
        return $this->hasMany(QuizBlueprint::class);
    }
}