package com.ywt.mg.domain.models.enums;

/**
 * 状态，位运算，1-已读，2-是否在用户端展示,4-全体推送，8-单独推送,16-未读,
 */
public enum ArticlesUnionStatusEnum {

    Read("已读", 1),
    IsShow("是否在用户端展示", 2),
    AllPush("全体推送", 4),
    SinglePush("单独推送", 8),
    NoRead("未读", 16),
    UNKNOWN("", 0);
    private final String displayName;

    private final int value;

    ArticlesUnionStatusEnum(String displayName, int value) {
        this.displayName = displayName;
        this.value = value;
    }

    public String getDisplayName() {
        return displayName;
    }

    public int getValue() {
        return value;
    }

    public static ArticlesUnionStatusEnum valueOf(int value) {
       if ((value & NoRead.value) == NoRead.value) {
            return NoRead;
        } else if ((value & SinglePush.value) == SinglePush.value) {
            return SinglePush;
        } else if ((value & AllPush.value) == AllPush.value) {
            return AllPush;
        } else if ((value & IsShow.value) == IsShow.value) {
            return IsShow;
        } else if ((value & Read.value) == Read.value) {
            return Read;
        } else {
            return UNKNOWN;
        }
    }

}