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

import java.util.Objects;

/**
 * @author yrf
 * @description
 * @time 2020/4/14 18:04
 */
public enum ExerciseBookStatusEnum {

    Repulse2AI(0, "repulse2AICount", "0打回AI"),
    Processing(1, "processingCount", "1加工中"),
    Repulse2Process(2, "repulse2ProcessCount", "2打回加工"),
    Auditing(3, "auditingCount", "3审核中"),
    Repulse2Audit(4, "repulse2AuditCount", "4打回审核"),
    QuestionPublished(5, "questionPublishedCount", "5题目已发布"),
    AnalysisProcessing(6, "analysisProcessingCount", "6解析加工中"),
    Repulse2AnalysisProcessing(7, "repulse2AnalysisProcessingCount", "7打回解析加工中"),
    AnalysisAuditing(8, "analysisAuditingCount", "8解析审核中"),
    Repulse2AnalysisAuditing(9, "repulse2AnalysisAuditingCount", "9打回解析审核中"),
    AnalysisPublished(10, "analysisPublishedCount", "10解析发布");

    private int code;
    private String name;
    private String description;

    ExerciseBookStatusEnum(int code, String name, String description) {
        this.code = code;
        this.name = name;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public String getDescription() {
        return description;
    }

    public static int getCodeByName(String name) {
        for (ExerciseBookStatusEnum value : ExerciseBookStatusEnum.values()) {
            if (Objects.equals(value.getName(), name)) {
                return value.getCode();
            }
        }
        return -1;
    }

    public static String getDescriptionByCode(Integer code) {
        for (ExerciseBookStatusEnum value : ExerciseBookStatusEnum.values()) {
            if (Objects.equals(value.getCode(), code)) {
                return value.getDescription();
            }
        }
        return "";
    }
}
