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


import lombok.Getter;

import java.util.Arrays;

/**
 * 状态枚举值
 */
@Getter
public enum StatusEnum {

    /**
     * 正常
     */
    ACTIVE(0, "active"),

    /**
     * 停用
     */
    INACTIVE(1, "inactive"),

    /**
     * all
     */
    ALL(3, "all");

    public final Integer code;
    public final String name;

    StatusEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static StatusEnum getByName(String name) {
        return Arrays.stream(values()).filter(statusEnum -> statusEnum.getName().equals(name)).findFirst().orElse(ACTIVE);
    }

}
