<?php

namespace Modules\Common\Repository\Options;

use Catch\Enums\Status as StatusEnum;
use Modules\WechatPlatform\Services\WechatPlatformConstService;

class CommonParams implements OptionInterface
{
    public function get(): array
    {
        /**
         * @see modules/Common/config/common.php
         */
        $commonConfig = config('common.common');
        return [
            /**
             * 支付类型
             */
           'payType' => $commonConfig['payType'],
            /**
             * 小程序类型
             */
            'miniprogramType' => $commonConfig['miniprogramType'],
            /**
             * 首页列表类型
             */
            'firstPageListType' => $commonConfig['firstPageListType'],
            /**
             * 微信公众号运营
             */
            'wechatPlatform' => [
                'kfMessageType' => $this->_turn(WechatPlatformConstService::KF_MESSAGE_TYPE_MAPPER),
                'kfMessageStatus' => $this->_turn(WechatPlatformConstService::KF_MESSAGE_STATUS_MAPPER),
            ]
        ];
    }

    private function _turn($arr) {
        $result = [];
        foreach ($arr as $key => $val) {
            $result[] = [
                'label' => $val,
                'value' => $key
            ];
        }
        return $result;
    }
}
