<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::table('olt_devices', function (Blueprint $table) {
            $table->string('default_onu_type', 50)->default('ZTE-F680')->after('default_speed_profile');
        });

        // Puerto Maldonado → ZTE-F660P, resto → ZTE-F680 (ya es el default)
        DB::table('olt_devices')
            ->where('name', 'like', '%MALDONADO%')
            ->orWhere('name', 'like', '%Maldonado%')
            ->update(['default_onu_type' => 'ZTE-F660P']);
    }

    public function down(): void
    {
        Schema::table('olt_devices', function (Blueprint $table) {
            $table->dropColumn('default_onu_type');
        });
    }
};
