<?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
    {
        // Text Overlay: text that can be overlaid on a video
        Schema::create('text_overlays', function (Blueprint $table) {
            $table->id();
            $table->foreignId('video_id'); // video this text overlay belongs to
            $table->text('text_content'); // text content
            $table->jsonb('style_payload')->nullable(); // font family, font size, font color, font weight, text align
            $table->string('cloud_filename')->nullable(); // filename on cloud storage
            $table->timestamps();

            $table->foreign('video_id')->references('id')->on('videos')->onDelete('cascade');
        });
    }

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