<?php

return [
    /*
     * 授权相关配置
     */
    'auth' => [
        'cache_prefix' => 'wechat_auth_state:',
        'cache_ttl' => 600, // 10分钟
        'default_scope' => 'snsapi_userinfo',
    ],

    /*
     * 默认配置,将会合并到各模块中
     */
    'defaults' => [
        /*
         * 指定 API 调用返回结果的类型:array(default)/object/raw/自定义类名
         */
        'response_type' => 'array',

        /*
         * 使用 Laravel 的缓存系统
         */
        'use_laravel_cache' => true,

        /*
         * 日志配置
         */
        'log' => [
            'default' => 'single',
            'channels' => [
                'single' => [
                    'driver' => 'single',
                    'path' => storage_path('logs/wechat.log'),
                    'level' => 'debug',
                ],
            ],
        ],
    ],

    /*
     * 公众号
     */
    'official_account' => [
        'default' => [
            'app_id' => env('WECHAT_OFFICIAL_ACCOUNT_APPID', ''),      // AppID
            'secret' => env('WECHAT_OFFICIAL_ACCOUNT_SECRET', ''),     // AppSecret
            'token' => env('WECHAT_OFFICIAL_ACCOUNT_TOKEN', ''),       // Token
            'aes_key' => env('WECHAT_OFFICIAL_ACCOUNT_AES_KEY', ''),  // EncodingAESKey

            /**
             * OAuth 配置
             */
            'oauth' => [
                'scopes' => ['snsapi_userinfo'],
                'callback' => env('WECHAT_OFFICIAL_ACCOUNT_OAUTH_CALLBACK', '/oauth_callback'),
            ],

            /**
             * 接口请求相关配置,超时时间等,具体可用参数请参考:
             * https://github.com/symfony/symfony/blob/5.3/src/Symfony/Contracts/HttpClient/HttpClientInterface.php
             */
            'http' => [
                'timeout' => 5.0,
                'retry' => true,
                'retry_delay' => 500,
                'max_retries' => 1,
            ],
        ],
    ],
];