<?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('block_manager_variant_drafts', function (Blueprint $table) {
            $table->increments('id');
            $table->char('uuid', 36)->unique();
            $table->string('element_type', 64);
            $table->string('variant_slug', 128);
            $table->string('label', 255)->nullable();
            $table->longText('properties_json')->nullable();
            $table->timestamp('last_published_at')->nullable();
            $table->string('published_twig_path', 255)->nullable();
            $table->string('published_less_path', 255)->nullable();
            $table->timestamps();

            $table->unique(['element_type', 'variant_slug'], 'block_manager_variant_drafts_element_slug_unique');
            $table->index('element_type');
        });
    }

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