package cn.com.qmth.stmms.common.enums;

import java.util.LinkedList;
import java.util.List;

public enum HistoryStatus {

    WAITING("待处理", 0), MARKED("已给分", 1), BACK("已打回", 2);

    private String name;

    private int value;

    private static List<HistoryStatus> options;

    private HistoryStatus(String name, int value) {
        this.name = name;
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public int getValue() {
        return value;
    }

    public static HistoryStatus findByValue(int value) {
        for (HistoryStatus c : HistoryStatus.values()) {
            if (c.getValue() == value) {
                return c;
            }
        }
        return null;
    }

    public static List<HistoryStatus> getOptionList() {
        if (options == null) {
            options = new LinkedList<>();
            for (HistoryStatus status : HistoryStatus.values()) {
                if (status != BACK) {
                    options.add(status);
                }
            }
        }
        return options;
    }
}
