<?php

if (!defined('YOCO_TESTING_MODE')) define('YOCO_TESTING_MODE', (bool)($_SERVER['YOCO_TESTING_MODE'] ?? $_ENV['YOCO_TESTING_MODE'] ?? true));

// Use test keys if in testing mode, otherwise use production keys from environment
$yoco_secret_key = YOCO_TESTING_MODE 
    ? ($_SERVER['YOCO_TEST_SECRET_KEY'] ?? $_ENV['YOCO_TEST_SECRET_KEY'] ?? '')
    : ($_SERVER['YOCO_SECRET_KEY'] ?? $_ENV['YOCO_SECRET_KEY'] ?? '');
    
$yoco_public_key = YOCO_TESTING_MODE 
    ? ($_SERVER['YOCO_TEST_PUBLIC_KEY'] ?? $_ENV['YOCO_TEST_PUBLIC_KEY'] ?? '')
    : ($_SERVER['YOCO_PUBLIC_KEY'] ?? $_ENV['YOCO_PUBLIC_KEY'] ?? '');

return [

    /*
    |--------------------------------------------------------------------------
    | Third Party Services
    |--------------------------------------------------------------------------
    |
    | This file is for storing the credentials for third party services such
    | as Mailgun, Postmark, AWS and more. This file provides the de facto
    | location for this type of information, allowing packages to have
    | a conventional file to locate the various service credentials.
    |
    */

    'postmark' => [
        'key' => env('POSTMARK_API_KEY'),
    ],

    'resend' => [
        'key' => env('RESEND_API_KEY'),
    ],

    'ses' => [
        'key' => env('AWS_ACCESS_KEY_ID'),
        'secret' => env('AWS_SECRET_ACCESS_KEY'),
        'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
    ],

    'slack' => [
        'notifications' => [
            'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
            'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
        ],
    ],

    'yoco' => [
        'mode' => env('YOCO_MODE', 'test'),
        'secret_key' => $yoco_secret_key,
        'public_key' => $yoco_public_key,
        'webhook_secret' => env('YOCO_WEBHOOK_SECRET'),
    ],

    'google' => [
        'client_id' => env('GOOGLE_CLIENT_ID'),
        'client_secret' => env('GOOGLE_CLIENT_SECRET'),
        'redirect' => env('GOOGLE_REDIRECT_URI', '/auth/google/callback'),
    ],

];
