<?php
$params = array_merge(
    require __DIR__ . '/../../common/config/params.php',
    require __DIR__ . '/../../common/config/params-local.php',
    require __DIR__ . '/params.php',
    require __DIR__ . '/params-local.php'
);

return [
    'id' => 'app-frontend',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log'],
    'controllerNamespace' => 'frontend\controllers',
    'modules' => [
        'api' => [
            'class' => 'frontend\modules\api\Api',
        ],
        'client' => [
            'class' => 'frontend\modules\client\Client',
        ],
        'web' => [
            'class' => 'frontend\modules\web\Web',
        ],
    ],
    'timeZone' => 'Asia/Shanghai',
    'components' => [
        'request' => [
            'csrfParam' => '_csrf-frontend',
            'parsers' => [
                'application/json' => 'yii\web\JsonParser',
                'text/json' => 'yii\web\JsonParser',
            ],
        ],
        'user' => [
            'identityClass' => 'common\models\User',
            'enableAutoLogin' => true,
            'identityCookie' => ['name' => '_identity-frontend', 'httpOnly' => true],
        ],
        'session' => [
            // this is the name of the session cookie used for login on the frontend
            'name' => 'advanced-frontend',
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning', 'info'],
                ],
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['info'],
                    'categories' => [
                        'frontend\modules\api\controllers\*',
                    ],
                    'logFile' => '@runtime/info.log',
                    'logVars' => ['_GET'],
                ],
            ],
        ],
        'errorHandler' => [
            'class' => 'common\components\AjaxErrorHandler',
        ],
        'urlManager' => [
            'enablePrettyUrl' => true,
            "enableStrictParsing" => FALSE,
            "showScriptName" => FALSE,
            "suffix" => "",
            'rules' => [],
        ]
    ],
    'params' => $params,
];
