package com.seer.teach.common.enums;

/**
 * @Author: Captain
 * @Description:
 * @Date: 2025-06-24 17:31
 */
public enum QuestionResultEnums {

    RIGHT(1, "正确"),
    WRONG(0, "错误");

    private final Integer code;
    private final String message;

    QuestionResultEnums(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    /**
     * 根据code获取对应的枚举
     *
     * @param code 状态码
     * @return 对应的枚举对象
     */
    public static QuestionResultEnums getByCode(Integer code) {
        for (QuestionResultEnums bookIsFreeEnums : values()) {
            if (bookIsFreeEnums.getCode().equals(code)) {
                return bookIsFreeEnums;
            }
        }
        return null;
    }
}
