package com.qmth.file.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 抽卷规则
 * @author tianjun
 *
 */
public enum ExamPaperRule {

	USE_LAST("使用上次考试的试卷", 0), USE_NEW("重新抽卷", 1);

    private String name;

    private int id;

    private ExamPaperRule(String name, int id) {
        this.name = name;
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public int getId() {
        return id;
    }
    
    public static List<Map<String, String>> toList() {
    	List<Map<String, String>> list = new ArrayList<Map<String, String>>();
    	  for (ExamPaperRule theme : ExamPaperRule.values()) {
    		  Map<String, String> map = new HashMap<String, String>();
    		  map.put(theme.name(), theme.getName());
          }
		return list;
    }

    public static ExamPaperRule findById(int id) {
        for (ExamPaperRule status : ExamPaperRule.values()) {
            if (status.id == id) {
                return status;
            }
        }
        return null;
    }

}
