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

import java.util.Set;

public enum Role {

    SYS_ADMIN("系统管理员"), SCHOOL_ADMIN("学校管理员"), CAMPUS_ADMIN("学习中心管理员"), EXAM_ADMIN("考试管理员"), MASTER("年级主任"), HEAD_TEACHER(
            "班主任"), SUBJECT_TEACHER("任课老师"), STUDENT("学生"),SUBJECT_VIEWER("科目查询员"),SCHOOL_VIEWER("学校查询员");

    private String display;

    private Set<Auth> auths;

    private Role(String display) {
        this.display = display;
    }

    public String getDisplay() {
        return display;
    }

    public String getName() {
        return toString().toLowerCase();
    }

    public static Role findByName(String name) {
        Role auth = null;
        for (Role item : Role.values()) {
            if (item.getName().equals(name)) {
                auth = item;
                break;
            }
        }
        return auth;
    }

    public Set<Auth> getAuths() {
        return auths;
    }

    public void setAuths(Set<Auth> auths) {
        this.auths = auths;
    }
}
