<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
    public function up(): void
    {
        if (DB::getDriverName() === 'mysql') {
            DB::statement("ALTER TABLE leads MODIFY status ENUM('active','inactive','archived','completed') NOT NULL DEFAULT 'active'");
        }
    }

    public function down(): void
    {
        if (DB::getDriverName() === 'mysql') {
            DB::table('leads')->where('status', 'completed')->update(['status' => 'inactive']);
            DB::statement("ALTER TABLE leads MODIFY status ENUM('active','inactive','archived') NOT NULL DEFAULT 'active'");
        }
    }
};
