<?php

namespace Database\Seeders;

use App\Models\ExamSession;
use App\Models\Exam;
use Illuminate\Database\Seeder;
use Carbon\Carbon;

class ExamSessionsSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $exam = Exam::first();

        if ($exam) {
            ExamSession::create([
                'exam_id' => $exam->id,
                'title' => 'Sesi 1',
                'start_time' => Carbon::now(),
                'end_time' => Carbon::now()->addMinutes($exam->duration),
            ]);
        }
    }
}
