<?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
    {
        // Video Template: Reusable videos that can be duplicated and edited to create new videos
        Schema::create('video_templates', function (Blueprint $table) {
            $table->id();
            $table->foreignId('user_id')->nullable(); // who owns it
            $table->boolean('is_public')->default(false); // can be viewed by anyone?
            $table->string('name', 255); // name of template
            $table->json('parameters'); // template configurations
            $table->timestamps();

            $table->foreign('user_id')->references('id')->on('users')->onDelete('set null');
        });
    }

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