<?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::table('event_packages', function (Blueprint $table) {
            if (! Schema::hasColumn('event_packages', 'gallery_warning_sent_at')) {
                $table->timestamp('gallery_warning_sent_at')->nullable()->after('gallery_expires_at');
            }

            if (! Schema::hasColumn('event_packages', 'gallery_expired_notified_at')) {
                $table->timestamp('gallery_expired_notified_at')->nullable()->after('gallery_warning_sent_at');
            }
        });
    }

    public function down(): void
    {
        Schema::table('event_packages', function (Blueprint $table) {
            if (Schema::hasColumn('event_packages', 'gallery_warning_sent_at')) {
                $table->dropColumn('gallery_warning_sent_at');
            }

            if (Schema::hasColumn('event_packages', 'gallery_expired_notified_at')) {
                $table->dropColumn('gallery_expired_notified_at');
            }
        });
    }
};
