<?php

declare(strict_types=1);

return [
    'enabled' => (bool) env('AI_GATEWAY_ENABLED', false),

    'default_provider' => env('AI_GATEWAY_PROVIDER', 'null'),

    'retry' => [
        'max_attempts' => (int) env('AI_GATEWAY_RETRY_MAX_ATTEMPTS', 3),
        'base_delay_ms' => (int) env('AI_GATEWAY_RETRY_BASE_DELAY_MS', 500),
        'max_delay_ms' => (int) env('AI_GATEWAY_RETRY_MAX_DELAY_MS', 5000),
    ],

    'quotas' => [
        'daily_tokens_per_tenant' => (int) env('AI_GATEWAY_DAILY_TOKEN_LIMIT', 100_000),
        'monthly_cost_usd_per_tenant' => (float) env('AI_GATEWAY_MONTHLY_COST_LIMIT_USD', 50),
    ],

    'providers' => [
        'openai' => [
            'api_key' => env('OPENAI_API_KEY'),
            'base_url' => env('OPENAI_BASE_URL', 'https://api.openai.com/v1'),
            'default_model' => env('OPENAI_DEFAULT_MODEL', 'gpt-4.1-nano'),
            'timeout_seconds' => (int) env('OPENAI_TIMEOUT_SECONDS', 60),
        ],
    ],

    /**
     * Custos por 1M tokens (USD). Atualize conforme tabela do provedor.
     *
     * @var array<string, array{input: float, output: float}>
     */
    'pricing' => [
        'default' => ['input' => 0.10, 'output' => 0.40],
        'gpt-4.1-nano' => ['input' => 0.10, 'output' => 0.40],
        'gpt-4o-mini' => ['input' => 0.15, 'output' => 0.60],
        'gpt-4o' => ['input' => 2.50, 'output' => 10.00],
    ],
];
