package pwc.taxtech.atms.dpo;

import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;
import java.util.stream.Collectors;

public class UserRoleInfo {

    /// 用户Id
    /// The identifier.
//    @JsonProperty("ID")
    private String id;

    /// 用户名
    /// The name of the user.
    private String userName;

    private String email;

    /// 1:激活
    /// -1:未激活
    /// 0:禁用
    /// 2:锁定
    /// The status.
    public Integer status;

    /// 机构Id
    /// The organization identifier.
    @JsonProperty("organizationID")
    private String organizationId;
    @JsonProperty("serviceTypeID")
    private String serviceTypeId;

    /// 机构名
    /// The name of the organization.
    private String organizationName;

    /// 事业部
    @JsonProperty("businessUnitID")
    private String businessUnitId;

    private String businessUnitName;

    /// 区域Id
    @JsonProperty("areaID")
    private String areaId;

    private String areaName;

    public Boolean isAccessible;

    /// 角色列表
    /// The role information list.
    public List<RoleInfo> roleInfoList;

    public String roleList;

    public String statusStr;

    /**
     * @return the id
     */
    public String getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(String id) {
        this.id = id;
    }

    /**
     * @return the userName
     */
    public String getUserName() {
        return userName;
    }

    /**
     * @param userName the userName to set
     */
    public void setUserName(String userName) {
        this.userName = userName;
    }

    /**
     * @return the email
     */
    public String getEmail() {
        return email;
    }

    /**
     * @param email the email to set
     */
    public void setEmail(String email) {
        this.email = email;
    }

    /**
     * @return the status
     */
    public Integer getStatus() {
        return status;
    }

    /**
     * @param status the status to set
     */
    public void setStatus(Integer status) {
        this.status = status;
    }

    /**
     * @return the organizationId
     */
    public String getOrganizationId() {
        return organizationId;
    }

    /**
     * the organizationId to set
     */
    public void setOrganizationId(String organizationId) {
        this.organizationId = organizationId;
    }

    /**
     * @return the serviceTypeId
     */
    public String getServiceTypeId() {
        return serviceTypeId;
    }

    /**
     * the serviceTypeId to set
     */
    public void setServiceTypeId(String serviceTypeId) {
        this.serviceTypeId = serviceTypeId;
    }

    /**
     * @return the organizationName
     */
    public String getOrganizationName() {
        return organizationName;
    }

    /**
     * @param organizationName the organizationName to set
     */
    public void setOrganizationName(String organizationName) {
        this.organizationName = organizationName;
    }

    /**
     * @return the businessUnitId
     */
    public String getBusinessUnitId() {
        return businessUnitId;
    }

    /**
     * the businessUnitId to set
     */
    public void setBusinessUnitId(String businessUnitId) {
        this.businessUnitId = businessUnitId;
    }

    /**
     * @return the areaId
     */
    public String getAreaId() {
        return areaId;
    }

    /**
     * @param areaId the areaId to set
     */
    public void setAreaId(String areaId) {
        this.areaId = areaId;
    }

    /**
     * @return the isAccessible
     */
    public Boolean getIsAccessible() {
        return isAccessible;
    }

    /**
     * @param isAccessible the isAccessible to set
     */
    public void setIsAccessible(Boolean isAccessible) {
        this.isAccessible = isAccessible;
    }

    /**
     * @return the roleInfoList
     */
    public List<RoleInfo> getRoleInfoList() {
        return roleInfoList;
    }

    /**
     * @param roleInfoList the roleInfoList to set
     */
    public void setRoleInfoList(List<RoleInfo> roleInfoList) {
        this.roleInfoList = roleInfoList;
    }

    public String getBusinessUnitName() {
        return businessUnitName;
    }

    public void setBusinessUnitName(String businessUnitName) {
        this.businessUnitName = businessUnitName;
    }

    public String getAreaName() {
        return areaName;
    }

    public void setAreaName(String areaName) {
        this.areaName = areaName;
    }

    public String getRoleList() {
        if(!this.roleInfoList.isEmpty()){
            List<String> rList = this.roleInfoList.stream().map(RoleInfo::getName).collect(Collectors.toList());
            return JSON.toJSONString(rList);
        }
        return roleList;
    }

    public void setRoleList(String roleList) {
        this.roleList = roleList;
    }

    public String getStatusStr() {
        return statusStr;
    }

    public void setStatusStr(String statusStr) {
        this.statusStr = statusStr;
    }
}