package com.jsowell.common.enums.thirdparty;

import com.jsowell.common.util.StringUtils;

/**
 * 第三方对接平台 type
 *
 * @author Lemon
 * @Date 2023/10/23 8:21:33
 */
public enum ThirdPlatformTypeEnum {
    LIAN_LIAN_PLATFORM("1", "上海联联平台", "425010765"),
    NING_BO_PLATFORM("2", "宁波平台", "14405899X"), // （原本名称为中电联平台）
    JIANG_SU_PLATFORM("3", "江苏省平台", "726079387"),
    YONG_CHENG_BO_CHE("4", "甬城泊车平台", "330205020"),
    NING_XIA_JIAO_TOU("5", "宁夏交投", "MA771QENX"),
    XIN_DIAN_TU("6", "新电途平台", "MA25CNM38"),
    HAI_NAN_1_PLATFORM("7", "海南一张网(监管平台)", "578725200"),
    HAI_NAN_2_PLATFORM("8", "海南一张网(充电平台)", "MAA9A0PP1"),
    HUA_WEI("9", "华为平台", "MA5GTQ528"),
    NEI_MENG_GU_PLATFORM("10", "内蒙古平台", ""),
    QING_HAI_PLATFORM("11", "青海平台", "630000000"),
    DIAN_XING_PLATFORM("12", "宁波点行停车平台", ""),
    NING_XIA_PLATFORM("13", "宁夏平台", "MA01H3BQ9"),
    SHEN_ZHEN_PLATFORM("14", "深圳平台", ""),
    ;

    private String typeCode;

    private String typeLabel;

    private String operatorId;

    public String getTypeCode() {
        return typeCode;
    }

    public void setTypeCode(String typeCode) {
        this.typeCode = typeCode;
    }

    public String getTypeLabel() {
        return typeLabel;
    }

    public void setTypeLabel(String typeLabel) {
        this.typeLabel = typeLabel;
    }

    public String getOperatorId() {
        return operatorId;
    }

    public void setOperatorId(String operatorId) {
        this.operatorId = operatorId;
    }

    ThirdPlatformTypeEnum(String typeCode, String typeLabel, String operatorId) {
        this.typeCode = typeCode;
        this.typeLabel = typeLabel;
        this.operatorId = operatorId;
    }

    /**
     * 根据 type 获取 label
     */
    public static String getTypeLabelByTypeCode(String typeCode) {
        for (ThirdPlatformTypeEnum item : ThirdPlatformTypeEnum.values()) {
            if (StringUtils.equals(item.getTypeCode(), typeCode)) {
                return item.getTypeLabel();
            }
        }
        return null;
    }

    /**
     * 根据 type 获取 operatorId
     */
    public static String getOperatorIdByCode(String typeCode) {
        for (ThirdPlatformTypeEnum item : ThirdPlatformTypeEnum.values()) {
            if (StringUtils.equals(item.getTypeCode(), typeCode)) {
                return item.getOperatorId();
            }
        }
        return null;
    }

    /**
     * 根据operatorId获取平台类型code
     * @param operatorId
     * @return
     */
    public static String getTypeCodeByOperatorId(String operatorId) {
        for (ThirdPlatformTypeEnum item : ThirdPlatformTypeEnum.values()) {
            if (StringUtils.equals(item.getOperatorId(), operatorId)) {
                return item.getTypeCode();
            }
        }
        return null;
    }
}
