package com.cm.smartgate.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.cm.smartgate.config.NetManagementConfig;
import com.cm.smartgate.service.AbstractSmartGateOperationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: DoorModeService
 * @Description: 通行模式操作业务
 * @Author: WangGeng
 * @Date: 2020/9/27 16:33
 * @Version: 1.0
 **/
@Service
public class GeneralModeOperationService extends AbstractSmartGateOperationService {

    @Autowired
    private NetManagementConfig netManagementConfig;

    @Override
    protected JSONObject getConfigSetting(int mode) {
        JSONObject contentObj = new JSONObject();
        contentObj.put("VerifyMode", mode);
        contentObj.put("Enable", true);
        contentObj.put("AccessType", 1);
        JSONObject accessFailObj = new JSONObject();
        accessFailObj.put("BackgroundColor", "Red");
        accessFailObj.put("ShowEnable", true);
        accessFailObj.put("ShowTips", "人证通行失败");
        accessFailObj.put("VoiceEnable", true);
        accessFailObj.put("VoiceTips", "人证通行失败");
        contentObj.put("AccessFail", accessFailObj);
        JSONObject accessOkObj = new JSONObject();
        accessOkObj.put("BackgroundColor", "Blue");
        accessOkObj.put("ShowEnable", true);
        accessOkObj.put("ShowTips", "人证通行成功");
        accessOkObj.put("VoiceEnable", true);
        accessOkObj.put("VoiceTips", "人证通行成功");
        contentObj.put("AccessOk", accessOkObj);
        return initConfigSetting("IDCardConfig", contentObj);
    }

    @Override
    protected String getConfigPath() {
        return netManagementConfig.getConfigPath();
    }
}
