<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('tobii_data', function (Blueprint $table) {
            $table->uuid('id_tobii_data')->primary();
            $table->string('gaze_x')->nullable()->default(0);
            $table->string('gaze_y')->nullable()->default(0);
            $table->string('timestamp');
            $table->uuid('id_test_sessions');
            $table->timestamps();

            // Foreign key constraint
            $table->foreign('id_test_sessions')->references('id_test_sessions')->on('test_sessions')->onDelete('cascade');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('tobii_data');
    }
};
