<?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('immigopro_quotation_questions', function (Blueprint $table) {
            // Drop the old enum column and recreate it with the new value
            $table->dropColumn('type');
        });
        
        Schema::table('immigopro_quotation_questions', function (Blueprint $table) {
            // Recreate the type column with 'color' added
            $table->enum('type', ['text', 'textarea', 'dropdown', 'radio', 'checkbox', 'number', 'email', 'phone', 'date', 'file', 'color'])->after('question');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('immigopro_quotation_questions', function (Blueprint $table) {
            $table->dropColumn('type');
        });
        
        Schema::table('immigopro_quotation_questions', function (Blueprint $table) {
            $table->enum('type', ['text', 'textarea', 'dropdown', 'radio', 'checkbox', 'number', 'email', 'phone', 'date', 'file'])->after('question');
        });
    }
};
