package com.qmth.teachcloud.common.enums.mark;

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

import com.qmth.teachcloud.common.enums.DataPermissionTypeEnum;
import com.qmth.teachcloud.common.enums.EnumResult;

public enum MarkProblemType {
    WRONG("答错位置", 0),
    BLUR("试卷模糊", 1),
    OTHER("其它", 2);

    private String desc;

    private int value;

    private static List<MarkProblemType> options;

    private MarkProblemType(String desc, int value) {
        this.desc = desc;
        this.value = value;
    }


    public String getDesc() {
		return desc;
	}

	public int getValue() {
        return value;
    }

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

    public static List<MarkProblemType> getOptionList() {
        if (options == null) {
            options = new LinkedList<>();
            for (MarkProblemType status : MarkProblemType.values()) {
                options.add(status);
            }
        }
        return options;
    }
    
    public static List<EnumResult> listTypes() {
        List<EnumResult> list = new ArrayList<EnumResult>();
        for (MarkProblemType value : MarkProblemType.values()) {
            EnumResult result = new EnumResult();
            result.setName(value.getDesc());
            result.setCode(value.name());
            result.setOrdinal(value.ordinal());
            list.add(result);
        }
        return list;
    }

}
