package ink.wgink.pojo.bos;

import org.springframework.security.core.GrantedAuthority;

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

/**
 * @ClassName: RoleGrantedAuthority
 * @Description: 角色权限
 * @Author: WangGeng
 * @Date: 2019-06-08 10:34
 * @Version: 1.0
 **/
public class RoleGrantedAuthorityBO implements GrantedAuthority {

    private static final long serialVersionUID = -6233744557312488547L;
    private String roleId;
    private String roleName;
    private List<String> menus;
    private List<String> inserts;
    private List<String> deletes;
    private List<String> updates;
    private List<String> queries;

    public RoleGrantedAuthorityBO() {
    }

    public RoleGrantedAuthorityBO(String roleId) {
        this.roleId = roleId;
    }

    public RoleGrantedAuthorityBO(String roleId, String roleName, List<String> menus,
                                  List<String> inserts,
                                  List<String> deletes,
                                  List<String> updates,
                                  List<String> queries) {
        this.roleId = roleId;
        this.roleName = roleName;
        this.menus = menus;
        this.inserts = inserts;
        this.deletes = deletes;
        this.updates = updates;
        this.queries = queries;
    }

    @Override
    public String getAuthority() {
        return this.roleId;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        } else {
            return obj instanceof RoleGrantedAuthorityBO ? this.roleId.equals(((RoleGrantedAuthorityBO) obj).roleId) : false;
        }
    }

    @Override
    public int hashCode() {
        return this.roleId.hashCode();
    }

    public String getRoleId() {
        return roleId == null ? "" : roleId.trim();
    }

    public void setRoleId(String roleId) {
        this.roleId = roleId;
    }

    public String getRoleName() {
        return roleName == null ? "" : roleName.trim();
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    public List<String> getMenus() {
        if (menus == null) {
            return new ArrayList<>();
        }
        return menus;
    }

    public void setMenus(List<String> menus) {
        this.menus = menus;
    }

    public List<String> getInserts() {
        if (inserts == null) {
            return new ArrayList<>();
        }
        return inserts;
    }

    public void setInserts(List<String> inserts) {
        this.inserts = inserts;
    }

    public List<String> getDeletes() {
        if (deletes == null) {
            return new ArrayList<>();
        }
        return deletes;
    }

    public void setDeletes(List<String> deletes) {
        this.deletes = deletes;
    }

    public List<String> getUpdates() {
        if (updates == null) {
            return new ArrayList<>();
        }
        return updates;
    }

    public void setUpdates(List<String> updates) {
        this.updates = updates;
    }

    public List<String> getQueries() {
        if (queries == null) {
            return new ArrayList<>();
        }
        return queries;
    }

    public void setQueries(List<String> queries) {
        this.queries = queries;
    }


}
