<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('meet_session_feedback', function (Blueprint $table) {
            $table->id();
            $table->foreignId('session_id')->constrained('meet_sessions')->cascadeOnDelete();
            $table->uuid('participant_uuid')->nullable()->index();
            $table->string('display_name')->nullable();
            $table->string('user_ref')->nullable()->index();
            $table->unsignedTinyInteger('rating');
            $table->unsignedTinyInteger('audio_rating')->nullable();
            $table->unsignedTinyInteger('video_rating')->nullable();
            $table->text('comment')->nullable();
            $table->timestamps();

            $table->unique(['session_id', 'participant_uuid']);
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('meet_session_feedback');
    }
};
