package org.jeecg.modules.pay.routing;

/**
 * 【与分账方的关系类型】子商户与接收方的关系。
 */
public enum RelationTypeEnum {
    SERVICE_PROVIDER("SERVICE_PROVIDER",0, "服务商"),
    STORE("STORE",1, "门店"),
    STAFF("STAFF",1, "员工"),
    STORE_OWNER("STORE_OWNER",1, "店主"),
    PARTNER("PARTNER",1, "合作伙伴"),
    HEADQUARTER("HEADQUARTER",1, "总部"),
    BRAND("BRAND",1, "品牌方"),
    DISTRIBUTOR("DISTRIBUTOR",1, "分销商"),
    USER("USER",1, "供应商"),
    SUPPLIER("SUPPLIER",1, "门店"),
    CUSTOM("CUSTOM",1, "自定义")
    ;
    public static String getTypeByValue(String value) {
        for (RelationTypeEnum c : RelationTypeEnum.values()) {
            if (c.value.equals(value)) {
                return c.type;
            }
        }
        return null;
    }

    // 成员变量
    private final String type;
    private final Integer value;
    private final String desc;

    // 构造方法 ,赋值给成员变量
    RelationTypeEnum(String type, Integer value, String desc) {
        this.type = type;
        this.value = value;
        this.desc = desc;
    }

    //覆盖方法  :只能使用toString方法来输出枚举变量值
    @Override
    public String toString() {
        return this.type + "_" + this.value+ "_" + this.desc;
    }
}
