<?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('organizations', function (Blueprint $table): void {
            $table->string('widget_header_style', 20)->default('gradient')->after('widget_powered_by_branding');
            $table->string('widget_header_color', 20)->nullable()->after('widget_header_style');
            $table->string('widget_header_gradient_to', 20)->nullable()->after('widget_header_color');
            $table->string('widget_header_text_color', 20)->nullable()->after('widget_header_gradient_to');
            $table->string('widget_status_background_color', 20)->nullable()->after('widget_header_text_color');
            $table->string('widget_body_background_color', 20)->nullable()->after('widget_status_background_color');
            $table->string('widget_date_pill_background_color', 20)->nullable()->after('widget_body_background_color');
            $table->string('widget_date_pill_text_color', 20)->nullable()->after('widget_date_pill_background_color');
            $table->string('widget_bot_message_background_color', 20)->nullable()->after('widget_date_pill_text_color');
            $table->string('widget_bot_message_text_color', 20)->nullable()->after('widget_bot_message_background_color');
            $table->string('widget_quick_reply_background_color', 20)->nullable()->after('widget_bot_message_text_color');
            $table->string('widget_quick_reply_text_color', 20)->nullable()->after('widget_quick_reply_background_color');
            $table->string('widget_composer_background_color', 20)->nullable()->after('widget_quick_reply_text_color');
            $table->string('widget_input_background_color', 20)->nullable()->after('widget_composer_background_color');
            $table->string('widget_send_button_color', 20)->nullable()->after('widget_input_background_color');
        });
    }

    public function down(): void
    {
        Schema::table('organizations', function (Blueprint $table): void {
            $table->dropColumn([
                'widget_header_style',
                'widget_header_color',
                'widget_header_gradient_to',
                'widget_header_text_color',
                'widget_status_background_color',
                'widget_body_background_color',
                'widget_date_pill_background_color',
                'widget_date_pill_text_color',
                'widget_bot_message_background_color',
                'widget_bot_message_text_color',
                'widget_quick_reply_background_color',
                'widget_quick_reply_text_color',
                'widget_composer_background_color',
                'widget_input_background_color',
                'widget_send_button_color',
            ]);
        });
    }
};
