<?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('meeting_effectiveness_reviews', function (Blueprint $table) {
            $table->id();
            $table->foreignId('meeting_id')->constrained()->cascadeOnDelete();
            $table->foreignId('user_id')->constrained()->cascadeOnDelete();
            $table->unsignedTinyInteger('objective_clarity');
            $table->unsignedTinyInteger('time_management');
            $table->unsignedTinyInteger('participation');
            $table->unsignedTinyInteger('outcome_quality');
            $table->unsignedTinyInteger('overall_rating');
            $table->text('comment')->nullable();
            $table->timestamps();

            $table->unique(['meeting_id', 'user_id']);
            $table->index(['meeting_id', 'overall_rating']);
        });
    }

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