<?php

return [
    'connections' => [
        'reverb' => [
            'driver' => 'reverb',
            'key' => env('REVERB_APP_KEY'),
            'secret' => env('REVERB_APP_SECRET'),
            'app_id' => env('REVERB_APP_ID'),
            'options' => [
                'host' => env('REVERB_HOST'),
                'port' => env('REVERB_PORT', 443),
                'scheme' => env('REVERB_SCHEME', 'https'),
                'useTLS' => env('REVERB_SCHEME', 'https') === 'https',
            ],
            'client_options' => [
                'verify' => false,
            ],
        ],

        'pusher' => [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'app_id' => env('PUSHER_APP_ID'),
            'options' => [
                'cluster' => env('PUSHER_APP_CLUSTER'),
                'host' =>
                    env('PUSHER_HOST') ?:
                    'api-' . env('PUSHER_APP_CLUSTER', 'mt1') . '.pusher.com',
                'port' => env('PUSHER_PORT', 443),
                'scheme' => env('PUSHER_SCHEME', 'https'),
                'encrypted' => true,
                'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
            ],
            'client_options' => [
                // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
            ],
        ],

        // need to use pusher driver, instead of ably drive from original laravel broadcasting config
        // otherwise "dontBroadcastToCurrentUser" will throw an error
        'ably' => [
            'driver' => 'pusher',
            'key' => explode(':', env('ABLY_KEY', ''))[0],
            'secret' => explode(':', env('ABLY_KEY', ''))[1] ?? null,
            'app_id' => explode('.', explode(':', env('ABLY_KEY', ''))[0])[0],
            'options' => [
                'scheme' => 'https',
                'host' => 'rest-pusher.ably.io',
                'port' => 443,
            ],
        ],

        'log' => [
            'driver' => 'log',
        ],

        'null' => [
            'driver' => 'null',
        ],
    ],
];
