<?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('organizations', function (Blueprint $table) {
            $table->string('ai_provider')->default('ollama')->after('timezone');
            $table->string('ai_model')->default('llama3')->after('ai_provider');
            $table->text('ai_api_key')->nullable()->after('ai_model');
            $table->string('ai_api_url')->nullable()->after('ai_api_key')->comment('For custom Ollama or OpenAI endpoints');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('organizations', function (Blueprint $table) {
            $table->dropColumn(['ai_provider', 'ai_model', 'ai_api_key', 'ai_api_url']);
        });
    }
};
