package com.ssj.service.kmt.exercisesys.enums;

import java.util.Objects;

public enum ProofreadStatusEnum {

    NotProofread(0, "未校对"),
    AnswerRight(1, "答案正确"),
    AnswerWrong(2, "答案错误"),
    ManagerModified(3, "管理员已修改");

    private Integer code;
    private String description;

    ProofreadStatusEnum(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public Integer getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static String getDescriptionByCode(Integer code) {
        if (code == null) {
            return "";
        }

        for (ProofreadStatusEnum proofreadStatusEnum : ProofreadStatusEnum.values()) {
            if (Objects.equals(code, proofreadStatusEnum.getCode())) {
                return proofreadStatusEnum.getDescription();
            }
        }

        return "";
    }
}
