package com.zanxiang.game.back.serve.pojo.enums;

import lombok.Getter;

import java.util.Objects;

@Getter
public enum BackStatusEnum {
    /**
     * 未回传
     */
    NO(0),
    /**
     * 回传成功
     */
    SUCCESS(1),
    /**
     * 部分成功
     */
    SUCCESS_PART(2),
    /**
     * 回传失败
     */
    FAILED(-1);

    private final Integer backStatus;

    BackStatusEnum(Integer backStatus) {
        this.backStatus = backStatus;
    }

    public static BackStatusEnum getByValue(Integer value) {
        if (value == null) {
            return null;
        }
        for (BackStatusEnum backStatus : BackStatusEnum.values()) {
            if (Objects.equals(backStatus.getBackStatus(), value)) {
                return backStatus;
            }
        }
        return null;
    }
}
