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 ExamLoginRule {

	ONLY_TICKET("准考证号", 0), TICKET_IDCARD("准考证号和身份证号", 1);

    private String name;

    private int id;

    private ExamLoginRule(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 (ExamLoginRule theme : ExamLoginRule.values()) {
    		  Map<String, String> map = new HashMap<String, String>();
    		  map.put(theme.name(), theme.getName());
          }
		return list;
    }

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

}
