package cn.ey.biz.module.system.enums.delegation;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 代理关系分类
 */
@AllArgsConstructor
@Getter
public enum DelegationTypeEnum {

    /**
     * RANK
     */
    RANK("01", "Rank"),

    /**
     * Mgmt Unit
     */
    MU("03", "Mgmt Unit"),

    /**
     * Sub-Mgmt Unit
     */
    SMU("02", "Sub-Mgmt Unit"),
    /**
     * Operating Unit
     */
    OU("04", "Operating Unit"),

    /**
     *  Business Unit
     */
    BU("05", "Business Unit"),

    /**
     * Geo Region
     */
    GEO_REGION("06", "Geo Region");


    public final String code;

    public final String value;


    public static DelegationTypeEnum getByCode(String code) {
        return Arrays.stream(values()).filter(delegationTypeEnum -> delegationTypeEnum.getCode().equals(code)).findFirst().orElse(null);
    }

}
