<?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('mailings', function (Blueprint $table) {
            $table->boolean('filter_by_profile_type')->default(false)->after('filter_by_location');
            $table->json('selected_profile_types')->nullable()->after('filter_by_profile_type')->comment('Array of profile types: User, Organization, Bank, Admin');
        });
    }

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