<?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('documents', function (Blueprint $table) {
            $table->json('data')->nullable()->after('status')
                ->comment('블록 빌더 문서 데이터 (JSON)');
            $table->longText('rendered_html')->nullable()->after('data')
                ->comment('렌더링된 HTML (PDF 생성용 캐시)');
            $table->string('pdf_path', 500)->nullable()->after('rendered_html')
                ->comment('생성된 PDF 파일 경로');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('documents', function (Blueprint $table) {
            $table->dropColumn(['data', 'rendered_html', 'pdf_path']);
        });
    }
};
