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

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

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

public enum MarkArbitrateStatus {

    WAITING("待处理", 0), MARKED("已给分", 1);

    private String name;

    private int value;

    private static List<MarkArbitrateStatus> options;

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

    public String getName() {
        return name;
    }

    public int getValue() {
        return value;
    }

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

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

    public static List<EnumResult> listTypes() {
        List<EnumResult> list = new ArrayList<EnumResult>();
        for (MarkArbitrateStatus value : MarkArbitrateStatus.values()) {
            EnumResult result = new EnumResult();
            result.setCode(value.name());
            result.setName(value.getName());
            result.setOrdinal(value.ordinal());
            list.add(result);
        }
        return list;
    }
}
