<?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('api_providers', function (Blueprint $table) {
            $table->timestamp('last_checked_at')->nullable()->after('plugin');
            $table->string('last_status', 50)->nullable()->after('last_checked_at');
            $table->unsignedInteger('last_response_time_ms')->nullable()->after('last_status');
            $table->text('last_error')->nullable()->after('last_response_time_ms');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('api_providers', function (Blueprint $table) {
            $table->dropColumn([
                'last_checked_at',
                'last_status',
                'last_response_time_ms',
                'last_error',
            ]);
        });
    }
};
