package com.nokia.sms.entity;

/*
     * Status 1 Unsigned Integer 否 状态
     * 见错误码表：
     * 0：成功
     * 12：消息结构错
     * 13：非法源地址
     * 14：认证错
     * 21~其它错误
     */
public enum BindRespStatus {
    SUCCESS((byte) 0, "成功"),
    STRUCTURE_ERROR((byte) 12, "消息结构错"),
    ILLEGAL_SOURCE_IP((byte) 13, "非法源地址"),
    AUTH_ERROR((byte) 14, "认证错"),
    OTHER_ERROR((byte) 21, "其他错误");

    public final byte value;
    public final String status;

    BindRespStatus(byte value, String status) {
        this.value = value;
        this.status = status;
    }

    public static BindRespStatus parse(byte value) {
        for (BindRespStatus status : values()) {
            if (value == status.value) {
                return status;
            }
        }
        return null;
    }

    @Override
    public String toString() {
        return name() + ":" + status;
    }
}
