package cn.pluss.platform.enums;

import cn.pluss.platform.exception.MsgException;
import cn.pluss.platform.util.StringUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * TODO
 * 下游渠道小程序配置相关信息
 * @author crystal
 * @date 2022/4/12 10:30
 */
@Getter
@AllArgsConstructor
public enum SubAppLetInfo {

    CSY("wx79b08abe2c635a78","f885694fa1cb93656b72db34f3dae211","仓鼠云收银台小程序"),
    MIMA("wx4dce83e9d6d42a6c","09d0ec30f8da544e396ad0b716f120f6","密码收银台小程序"),
    TR("wx6639bea0f0c6d648","d060a877a09b48a8dc42f2eb66e08b25","天润收银小程序"),
    SYB("wxaa8c9e6857a265e1","2ca82f68f5fa680bc6fc924fd22bd52d","收银呗智慧收银小程序");

    private String appid;

    private String secret;

    private String desc;

    public static String getSecretByAppid(String appid) {
        if(StringUtil.isEmpty(appid)){
            MsgException.throwException("appid为空,获取异常");
        }
        SubAppLetInfo[] appLetInfos = values();
        for (SubAppLetInfo sl : appLetInfos) {
            if (sl.appid.equals(appid)) {
                return sl.getSecret();
            }
        }
        return "";
    }
}
