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

import java.util.Objects;

public enum ExerciseBookHalfBookEnum {

    WholeBook(0, "整本"),
    FirstHalf(1, "上半"),
    SecondHalf(2, "下半");

    private Integer code;
    private String description;

    ExerciseBookHalfBookEnum(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 (ExerciseBookHalfBookEnum proofreadStatusEnum : ExerciseBookHalfBookEnum.values()) {
            if (Objects.equals(code, proofreadStatusEnum.getCode())) {
                return proofreadStatusEnum.getDescription();
            }
        }

        return "";
    }
}
