package com.yonge.cooleshow.biz.dal.enums;


import com.yonge.toolset.base.enums.BaseEnum;

public enum ImNetworkRoomErrorEnum implements BaseEnum<Integer,ImNetworkRoomErrorEnum> {
    ERR_SUCCESS(200, "OK"),
    ERR_REQUEST_PARA_ERR(1, "Missing or invalid parameter"),
    ERR_INVALID_AUTH(2, "Invalid or expired authorization"),
    ERR_ACCESS_DENIED(3, "Access denied"),
    ERR_BAD_REQUEST(4, "Bad request"),

    //IM error
    ERR_IM_TOKEN_ERROR(10, "IM token error"),
    ERR_CREATE_ROOM_ERROR(11, "Create room error"),
    ERR_JOIN_ROOM_ERROR(12, "Join room error"),
    JOIN_ROOM_ERROR(35, "加入房间失败,请前往线下教室"),
    ROOM_NOT_START(36, "网络教室暂未开启，请稍后重试"),
    CLOUD_BALANCE_NOT_FEE(37, "云教室受限不可进入，请联系教务老师。"),
    ERR_MESSAGE_ERROR(13, "IM Message send error"),


    //room error
    ERR_ROOM_NOT_EXIST(20, "Room not exist"),
    ERR_USER_NOT_EXIST_IN_ROOM(21, "User not exist in room"),
    ERR_EXIT_ROOM_ERROR(22, "Exit room error"),
    ERR_TEACHER_NOT_EXIST_IN_ROOM(23, "Teacher not exist in room"),
    ERR_ASSISTANT_NOT_EXIST_IN_ROOM(24, "Assistant not exist in room"),
    ERR_CREATE_WHITE_BOARD(25, "Create whiteboard error"),
    ERR_WHITE_BOARD_NOT_EXIST(26, "Whiteboard not exist"),
    ERR_DELETE_WHITE_BOARD(27, "Delete whiteboard error"),
    ERR_USER_EXIST_IN_ROOM(28, "User exist in room"),
    ERR_CHANGE_SELF_ROLE(29, "Can not change self role"),
    ERR_APPLY_TICKET_INVALID(30, "Apply ticket invalid"),
    ERR_OVER_MAX_COUNT(31, "云教室人数已超上线"),
    ERR_TEACHER_EXIST_IN_ROOM(32, "Teacher exist in room"),
    ERR_DOWNGRADE_ROLE(33, "Can't downgrade role"),
    ERR_CHANGE_ROLE(34, "Only change student to teacher");

    private int code;

    private ImNetworkRoomErrorEnum(int code, String remark) {
        this.code = code;
        this.remark = remark;
    }

    private String remark;

    public Integer getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public static ImNetworkRoomErrorEnum codeOf(int code) {
        for (ImNetworkRoomErrorEnum errorEnum : ImNetworkRoomErrorEnum.values()) {
            if (code == errorEnum.getCode()) {
                return errorEnum;
            }
        }
        return null;
    }
}
