package com.cm.common.token.app.entity;

import java.util.List;

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: UserInfo
 * @Description:
 * @Author: WangGeng
 * @Date: 2019-08-02 11:20
 * @Version: 1.0
 **/
public class AppTokenUser {

    private String id;
    private String name;
    private String avatar;
    private String username;
    private String phone;
    private String email;
    private List<AppTokenUserRole> roles;
    private List<AppTokenUserPosition> positions;
    private List<AppTokenUserDepartment> departments;
    private List<AppTokenUserGroup> groups;

    public String getId() {
        return id == null ? "" : id.trim();
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name == null ? "" : name.trim();
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAvatar() {
        return avatar == null ? "" : avatar.trim();
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getUsername() {
        return username == null ? "" : username.trim();
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPhone() {
        return phone == null ? "" : phone.trim();
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email == null ? "" : email.trim();
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public List<AppTokenUserRole> getRoles() {
        return roles;
    }

    public void setRoles(List<AppTokenUserRole> roles) {
        this.roles = roles;
    }

    public List<AppTokenUserPosition> getPositions() {
        return positions;
    }

    public void setPositions(List<AppTokenUserPosition> positions) {
        this.positions = positions;
    }

    public List<AppTokenUserDepartment> getDepartments() {
        return departments;
    }

    public void setDepartments(List<AppTokenUserDepartment> departments) {
        this.departments = departments;
    }

    public List<AppTokenUserGroup> getGroups() {
        return groups;
    }

    public void setGroups(List<AppTokenUserGroup> groups) {
        this.groups = groups;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"id\":")
                .append("\"").append(id).append("\"");
        sb.append(",\"name\":")
                .append("\"").append(name).append("\"");
        sb.append(",\"avatar\":")
                .append("\"").append(avatar).append("\"");
        sb.append(",\"username\":")
                .append("\"").append(username).append("\"");
        sb.append(",\"phone\":")
                .append("\"").append(phone).append("\"");
        sb.append(",\"email\":")
                .append("\"").append(email).append("\"");
        sb.append(",\"roles\":")
                .append(roles);
        sb.append(",\"positions\":")
                .append(positions);
        sb.append(",\"departments\":")
                .append(departments);
        sb.append(",\"groups\":")
                .append(groups);
        sb.append('}');
        return sb.toString();
    }
}
