<?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',
    'name'=>'Лінія Світла',
    'basePath' => dirname(__DIR__),
    'controllerNamespace' => 'frontend\controllers',
    'modules' => [

    ],
    'components' => [
        'assetManager' => [
            'bundles' => [
                'yii\web\JqueryAsset' =>[
                    'jsOptions' =>  ['position' => \yii\web\View::POS_END]
                ]
            ],
        ],
        'authManager' => [
            'class' => 'yii\rbac\DbManager',
        ],
        'user' => [
            'identityClass'   => 'common\models\Customer',
            'enableAutoLogin' => true,
            'loginUrl'        => ['login'],
        ],
        'request'=>[
            'cookieValidationKey' => 'ndahjhjjidasuidrqeswuiuirqw89',
            'csrfParam' => '_frontendCSRF',
            'class' => 'common\components\Request',

            'web'=> '/frontend/web'

        ],

        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],

        'urlManager'   => [
            'enablePrettyUrl' => true,
            'showScriptName'  => false,
            'rules'           => [
                ''                                                                 => 'site/main',
                'login'                                                            => 'login/main',
                'iam'                                                              => 'iam/main',
                'text/<translit:[\w\_\-]+>'                                        => 'text/main',
                '<language:(ru|ua|en)>/text/<translit:\w+>'                        => 'text/main',
                [
                    'class' => '\common\modules\product\CatalogUrlManager',
                    'route_map' => [
                        'catalog' => 'catalog/category',
                        'product' => 'catalog/product',
                        '<product:^(.+)\.htm$>' => 'catalog/product', //linija sveta


                    ]
                ],

                'cabinet/main'                                                             => '/cabinet/main',
                'priceparam.xml'    => 'site/priceparam',
                'price.xml'         => 'site/price',
                'smstest'           => 'site/sms',
                'search/main'            => 'search/main',
                'news/<translit:\w+>'                                     => 'news/show',
                'brands/main'                                                           => 'catalog/brands',
                'brands/<brand:[\w\-]+>'                                           => 'catalog/brand',
                'articles/main'                                                             => 'articles/main',
                'articles/<translit:[\w\-\_]+>'                                 => 'articles/show',
                'event/main'                                                            => 'event/main',
                'event/sale/<percent:[\d\-]+>'                                   => 'event/sale',
                'event/<alias:[\w\-]+>'                                   => 'event/show',
            ],
            'class'           => 'common\components\urlManager\LangUrlManager',
            'languages'       => ['ru', 'ua', 'en'],
            'lang'            => 'ru',
            'langParam'       => 'language',
        ],

    ],
    'params' => $params,
];
