package com.flossom.miniProgram.service.impl;

import com.flossom.common.core.domain.entity.WxOtherSetting;
import com.flossom.common.core.domain.entity.WxSystemSetting;
import com.flossom.common.core.enums.SystemSettingKeyEnum;
import com.flossom.common.core.mapper.WxOtherSettingMapper;
import com.flossom.common.core.mapper.WxSystemSettingMapper;
import com.flossom.miniProgram.service.ISystemSettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SystemSettingServiceImpl implements ISystemSettingService {

    @Autowired
    private WxSystemSettingMapper systemSettingMapper;

    @Autowired
    private WxOtherSettingMapper wxOtherSettingMapper;

    /**
     * 获取 用户协议
     *
     * @return
     */
    @Override
    public WxSystemSetting getUserAgreement() {
        return systemSettingMapper.getSystemSettingByKey(SystemSettingKeyEnum.USER_AGREEMENT.getKey());
    }


    /**
     * 获取 隐私协议
     *
     * @return
     */
    @Override
    public WxSystemSetting getPrivacyAgreement() {
        return systemSettingMapper.getSystemSettingByKey(SystemSettingKeyEnum.PRIVACY_AGREEMENT.getKey());
    }

    /**
     * 获取 积分规则
     *
     * @return
     */
    @Override
    public WxSystemSetting getIntegralRule() {
        return systemSettingMapper.getSystemSettingByKey(SystemSettingKeyEnum.INTEGRAL_RULE.getKey());
    }

    /**
     * 获取 关于我们
     *
     * @return
     */
    @Override
    public WxSystemSetting getAboutUs() {
        return systemSettingMapper.getSystemSettingByKey(SystemSettingKeyEnum.ABOUT_US.getKey());
    }

    /**
     * 获取蓝牙指引权限
     *
     * @return
     */
    @Override
    public WxSystemSetting getBluetoothGuidance() {
        return systemSettingMapper.getSystemSettingByKey(SystemSettingKeyEnum.BLUETOOTH_GUIDANCE_PERMISSIONS.getKey());
    }

    /**
     * 获取定位指引权限
     *
     * @return
     */
    @Override
    public WxSystemSetting getLocationGuidance() {
        return systemSettingMapper.getSystemSettingByKey(SystemSettingKeyEnum.LOCATION_GUIDANCE_PERMISSIONS.getKey());
    }

    /**
     * 获取联系客服
     *
     * @return
     */
    @Override
    public WxSystemSetting getContactWorker() {
        return systemSettingMapper.getSystemSettingByKey(SystemSettingKeyEnum.CONTACT_WORKER.getKey());
    }

    @Override
    public WxOtherSetting getOtherSetting() {
        return wxOtherSettingMapper.selectWxOtherSettingById(1L);
    }
}
