<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('ai_providers', function (Blueprint $table) {
            $table->id();
            $table->string('provider_key')->unique(); // e.g., 'openai', 'gemini'
            $table->string('provider_name'); // e.g., 'OpenAI GPT-4'
            $table->string('api_endpoint');
            $table->text('api_key')->nullable(); // Will be encrypted
            $table->string('default_model');
            $table->text('notes')->nullable();
            $table->integer('priority')->default(99);
            $table->boolean('is_enabled')->default(true); // Can be used by the system
            $table->boolean('is_active')->default(false); // The one currently in use
            $table->timestamps();
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('ai_providers');
    }
};