<?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('events', function (Blueprint $table) {
            if (! Schema::hasColumn('events', 'settings')) {
                $table->json('settings')->nullable()->after('max_participants');
            }

            $table->boolean('watermark_serve_originals')->default(false)->after('settings');
            $table->json('watermark_settings')->nullable()->after('watermark_serve_originals');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('events', function (Blueprint $table) {
            $table->dropColumn(['watermark_settings', 'watermark_serve_originals']);
        });
    }
};
