<?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('site_settings', function (Blueprint $table) {
            if (!Schema::hasColumn('site_settings', 'policy_pages_json')) {
                $table->longText('policy_pages_json')->nullable();
            }
            if (!Schema::hasColumn('site_settings', 'landing_theme')) {
                $table->string('landing_theme')->nullable();
            }
            if (!Schema::hasColumn('site_settings', 'main_landing_title')) {
                $table->string('main_landing_title')->nullable();
            }
            if (!Schema::hasColumn('site_settings', 'main_landing_subtitle')) {
                $table->text('main_landing_subtitle')->nullable();
            }
            if (!Schema::hasColumn('site_settings', 'banner_text')) {
                $table->string('banner_text')->nullable();
            }
            if (!Schema::hasColumn('site_settings', 'primary_logo')) {
                $table->text('primary_logo')->nullable();
            }
            if (!Schema::hasColumn('site_settings', 'contact_phone')) {
                $table->string('contact_phone')->nullable();
            }
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('site_settings', function (Blueprint $table) {
            $table->dropColumn([
                'policy_pages_json', 'landing_theme', 'main_landing_title',
                'main_landing_subtitle', 'banner_text', 'primary_logo', 'contact_phone'
            ]);
        });
    }
};
