<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use App\Enums\NotificationStatus;

return new class extends Migration
{
    public function up(): void
    {
        Schema::table('links', function (Blueprint $table) {
            $table->enum('email_status', array_column(NotificationStatus::cases(), 'value'))
                  ->default(NotificationStatus::Pending->value)
                  ->after('status');
            $table->enum('whatsapp_status', array_column(NotificationStatus::cases(), 'value'))
                  ->default(NotificationStatus::Pending->value)
                  ->after('email_status');
        });
    }

    public function down(): void
    {
        Schema::table('links', function (Blueprint $table) {
            $table->dropColumn(['email_status','whatsapp_status']);
        });
    }
};
