package com.friday.custody.enums;

import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.annotation.JSONCreator;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * 托管方名称与编号的枚举类
 */
public enum DaasTrustNoEnum {

    PING_AN_BANK("14","平安银行"),
    HAI_TONG("21","海通"),
    GUOSEN("22","国信证券"),
    CMSC("25","招商"),
    GUANG_FA_SECURITIES("30","广发"),
    GUO_TAI_JUN_AN("31","国泰君安"),
    YINHE("33","银河"),
    HTSC("34","华泰证券"),
    ZHONG_XIN("35","中信"),
    XING_YE_SECURITIES("36","兴业"),
    CSCS("38","中信"),
    zhongjin("39","中金国际"),
    ZHONGTAI("41","中泰"),
    EBSCN("42","光大"),
    ANXIN("43","安信"),
    SW("45","申万"),
    CHANGJIANG("54","长江"),
    DIYI("97","第一创业"),
    GUOJIN("98","国金道富"),
    EMAIL("44","邮件解析公共service")
    ;
    private String code;
    private String type;

    DaasTrustNoEnum(String code, String type) {
        this.code = code;
        this.type = type;
    }
    @JsonValue
    @JSONField
    public String getCode() {
        return code;
    }

    public String getType() {
        return type;
    }

    @JsonCreator
    @JSONCreator
    public static DaasTrustNoEnum fromCode(String code) {
        for (DaasTrustNoEnum value : DaasTrustNoEnum.values()) {
            if (StringUtils.equals(value.getCode(), code)) {
                return value;
            }

        }
        throw new IllegalArgumentException(code);
    }
}
