<?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
    {
        Schema::table('document_templates', function (Blueprint $table) {
            $table->string('builder_type', 20)->default('legacy')->after('category')
                ->comment('빌더 유형 (legacy: 기존 EAV, block: 블록 빌더)');
            $table->json('schema')->nullable()->after('footer_judgement_options')
                ->comment('블록 빌더 JSON 스키마');
            $table->json('page_config')->nullable()->after('schema')
                ->comment('페이지 설정 (용지 크기, 방향, 여백 등)');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('document_templates', function (Blueprint $table) {
            $table->dropColumn(['builder_type', 'schema', 'page_config']);
        });
    }
};
