<?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('match_points', function (Blueprint $table) {
            $table->id();
            $table->foreignId('video_id')->constrained()->onDelete('cascade');
            $table->foreignId('match_round_id')->constrained('match_rounds')->onDelete('cascade');
            $table->integer('timestamp_seconds');
            $table->string('action');
            $table->integer('points');
            $table->string('competitor'); // 'blue' or 'red'
            $table->string('notes')->nullable();
            $table->integer('score_blue')->default(0);
            $table->integer('score_red')->default(0);
            $table->timestamps();
        });
    }

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