<?php

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

return new class extends Migration {
    public function up(): void
    {
        $now = now();
        DB::table('settings')->insertOrIgnore([
            [
                'group' => 'ip_allocation',
                'key' => 'ip_allocation.master_enabled',
                'value' => '1',
                'created_at' => $now,
                'updated_at' => $now,
            ],
            [
                'group' => 'ip_allocation',
                'key' => 'ip_allocation.default_quarantine',
                'value' => '7',
                'created_at' => $now,
                'updated_at' => $now,
            ],
        ]);
    }

    public function down(): void
    {
        DB::table('settings')->whereIn('key', [
            'ip_allocation.master_enabled',
            'ip_allocation.default_quarantine',
        ])->delete();
    }
};
