<?php
return [
    'name' => 'HANUMAN PATHOLOGY LIS',
    'timeZone' => 'Asia/Bangkok',
    'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
    'language' => 'th-TH',
    'aliases' => [
        '@bower' => '@vendor/bower-asset',
        '@npm' => '@vendor/npm-asset',
        '@uploadsUrl' => '/uploads',
        '@uploads' => dirname(dirname(__DIR__)) . '/frontend/web/uploads',
    ],
    'container' => [
        'definitions' => [
            \yii\widgets\LinkPager::class => \yii\bootstrap5\LinkPager::class,
        ],
    ],
    'bootstrap' => [], //'setting'
    'components' => [
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                // เก็บเฉพาะ error → ไปที่ error.log
                [
                    'class' => \yii\log\FileTarget::class,
                    'levels' => ['error'],
                    'logFile' => '@runtime/logs/error.log',
                    'logVars' => [],
                    'enableRotation' => true,
                    'maxFileSize' => 10240, // KB
                    'maxLogFiles' => 10,
                    // ตัด error บางชนิดออกได้ (เช่น 404 ที่รก log)
                    'except' => [
                        'yii\web\HttpException:404',
                    ],
                ],

                // ถ้ายังอยากเก็บ warning/info แยกไฟล์กันไป (เอา block นี้ออกได้)
                // [
                //     'class' => \yii\log\FileTarget::class,
                //     'levels' => ['warning', 'info'],
                //     'logFile' => '@runtime/logs/app.log',
                //     'logVars' => [],
                // ],
            ],
        ],
        'cache' => [
            'class' => 'yii\caching\FileCache',
        ],
        'pathology' => [
            'class' => 'common\components\Pathology'
        ],
        'thai' => [
            'class' => 'common\components\Thai'
        ],
        'supply' => [
            'class' => 'common\components\Supply'
        ],
        'formatter' => [
            'class' => 'yii\i18n\Formatter',
            'nullDisplay' => '',
        ],
        /*'setting' => [
            'class' => 'common\components\Setting'
        ],*/
        'thaiFormatter' => [
            'class' => 'dixonsatit\thaiYearFormatter\ThaiYearFormatter',
        ],
        'excelExporter' => [
            'class' => 'common\components\ExcelExporter'
        ],
        'finance' => [
            'class' => 'common\components\Finance'
        ],

        'queue' => [
            'class' => \yii\queue\db\Queue::class,
            'db' => 'db', // DB connection component or its config
            'tableName' => '{{%queue}}', // Table name
            'channel' => 'default', // Queue channel key
            'mutex' => \yii\mutex\MysqlMutex::class, // Mutex used to sync queries
            'as log' => \yii\queue\LogBehavior::class
        ],

    ],
];
