package cn.pluss.platform.yinsheng;

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

/**
 * TODO
 * 银盛发起方主题下对应的默认付款小程序appid参数
 * @author crystal
 * @date 2022/7/12 18:52
 */
@Getter
@AllArgsConstructor
public enum YsOldSrcMerchantNo {

    RSCY("826521773920170","wxaa8c9e6857a265e1","gh_5a1aa6143567","融商创赢(发起方)"),

    SYB("826521673920090","wxc2ecf9662691832e","gh_d0571a5c903e","收银呗(发起方)");

    private String value;

    private String defSubAppid;

    private String defGhId;

    private String desc;

    public static String getGhIdByValue(String value) {
        if(StringUtil.isEmpty(value)){
            return YsOldSrcMerchantNo.RSCY.getDefGhId();
        }
        YsOldSrcMerchantNo[] srcMerchantNoEnums = values();
        for (YsOldSrcMerchantNo ysOldSrcMerchantNo : srcMerchantNoEnums) {
            if (ysOldSrcMerchantNo.getValue().equals(value)) {
                return ysOldSrcMerchantNo.getDefGhId();
            }
        }
        return YsOldSrcMerchantNo.RSCY.getDefGhId();
    }

    public static String getSubAppIdByValue(String value) {
        if(StringUtil.isEmpty(value)){
            return YsOldSrcMerchantNo.RSCY.getDefSubAppid();
        }
        YsOldSrcMerchantNo[] srcMerchantNoEnums = values();
        for (YsOldSrcMerchantNo ysOldSrcMerchantNo : srcMerchantNoEnums) {
            if (ysOldSrcMerchantNo.getValue().equals(value)) {
                return ysOldSrcMerchantNo.getDefSubAppid();
            }
        }
        return YsOldSrcMerchantNo.RSCY.getDefSubAppid();
    }
}
