package com.uas.account.entity;

import java.io.Serializable;

import com.uas.sso.common.util.StringUtil;

/**
 * <pre>
 * App1					App2
 * +					-
 * +	+			-	-
 * +		+	-		-
 * +		-	+		-
 * +	-			+	-
 * UserSpace1		UserSpace2
 * +					-
 * + + +		   -   - 	
 * +   +  +		-     -
 * +     +   *	     -
 * +	   *    +   -
 * +	-	 +	   *
 * +  -		   +  -	    +
 * *		     *		    +
 * User1		User2		User3
 * </pre>
 * 
 * 用户集
 * 
 * @author yingp
 * 
 */
public class UserSpace implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private String appId;

	private Long id;

	private String uid;

	private String dialectUID;

	private String name;

	private Integer userCount;

	public UserSpace() {
	}

	public UserSpace(App app, UserSpaceDetail detail) {
		this.appId = app.getUid();
		this.uid = detail.getBusinessCode();
		this.name = detail.getName();
		this.userCount = 0;
	}

	/**
	 * 属于哪个应用
	 */
	public String getAppId() {
		return appId;
	}

	public void setAppId(String appId) {
		this.appId = appId;
	}

	/**
	 * ID
	 */
	public Long getId() {
		return id;
	}

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

	/**
	 * 全局唯一标识，比如企业的商业登记证号、税务登记证号，所有接入的业务系统都认可使用的同一个标识
	 */
	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	/**
	 * 名称
	 */
	public String getName() {
		return name;
	}

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

	@Override
	public String toString() {
		return "appId=" + StringUtil.nvl(appId, "") + "&id=" + StringUtil.nvl(id, "") + "&uid=" + StringUtil.nvl(uid, "") + "&name="
				+ StringUtil.nvl(name, "") + "&dialectUID=" + StringUtil.nvl(dialectUID, "");
	}

	/**
	 * 业务系统自己的，除UID之外的，唯一标识字段（例如，en_uu） <br>
	 * 因为业务系统可能历史原因，部分企业信息并没有UID
	 * 
	 * @return
	 */
	public String getDialectUID() {
		return dialectUID;
	}

	public void setDialectUID(String dialectUID) {
		this.dialectUID = dialectUID;
	}

	/**
	 * 绑定的用户个数
	 */
	public Integer getUserCount() {
		return userCount;
	}

	public void setUserCount(Integer userCount) {
		this.userCount = userCount;
	}

}
