package com.phlx.anchorcollect.entity;

import android.os.Parcel;
import android.os.Parcelable;

import androidx.annotation.Size;
import androidx.databinding.BaseObservable;

import java.util.Date;
import java.util.List;

/**
 * 用户对象 sys_user
 * 
 * @author ruoyi
 */
public class UserEntity extends BaseObservable implements Parcelable {

    /** 用户ID */
    private String userId;

    /** 部门ID */
    private String deptId;

    /** 部门父ID */
    private String parentId;

    /** 角色ID */
    private String roleId;

    /** 登录名称 */
    private String loginName;

    /** 用户名称 */
    private String userName;

    /** 用户类型 */
    private String userType;

    /** 用户邮箱 */
    private String email;

    /** 手机号码 */
    private String phonenumber;

    /** 用户性别 */
    private String sex;

    /** 用户头像 */
    private String avatar;

    /** 密码 */
    private String password;

    /** 盐加密 */
    private String salt;

    /** 帐号状态（0正常 1停用） */
    private String status;

    /** 删除标志（0代表存在 2代表删除） */
    private String delFlag;

    /** 最后登录IP */
    private String loginIp;

    /** 最后登录时间 */
    private String loginDate;

    /** 密码最后更新时间 */
    private String pwdUpdateDate;

    /** 部门对象 */
    private DeptEntity dept;

    private List<UserRoleEntity> roles;

    /** 角色组 */
//    private String[] roleIds;
//
//    /** 岗位组 */
//    private String[] postIds;

    public UserEntity() {

    }

    protected UserEntity(Parcel in) {
        userId = in.readString();
        deptId = in.readString();
        parentId = in.readString();
        roleId = in.readString();
        loginName = in.readString();
        userName = in.readString();
        userType = in.readString();
        email = in.readString();
        phonenumber = in.readString();
        sex = in.readString();
        avatar = in.readString();
        password = in.readString();
        salt = in.readString();
        status = in.readString();
        delFlag = in.readString();
        loginIp = in.readString();
        loginDate = in.readString();
        pwdUpdateDate = in.readString();
        dept = in.readParcelable(DeptEntity.class.getClassLoader());
        roles = in.createTypedArrayList(UserRoleEntity.CREATOR);
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(userId);
        dest.writeString(deptId);
        dest.writeString(parentId);
        dest.writeString(roleId);
        dest.writeString(loginName);
        dest.writeString(userName);
        dest.writeString(userType);
        dest.writeString(email);
        dest.writeString(phonenumber);
        dest.writeString(sex);
        dest.writeString(avatar);
        dest.writeString(password);
        dest.writeString(salt);
        dest.writeString(status);
        dest.writeString(delFlag);
        dest.writeString(loginIp);
        dest.writeString(loginDate);
        dest.writeString(pwdUpdateDate);
        dest.writeParcelable(dept, flags);
        dest.writeTypedList(roles);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<UserEntity> CREATOR = new Creator<UserEntity>() {
        @Override
        public UserEntity createFromParcel(Parcel in) {
            return new UserEntity(in);
        }

        @Override
        public UserEntity[] newArray(int size) {
            return new UserEntity[size];
        }
    };

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getDeptId() {
        return deptId;
    }

    public void setDeptId(String deptId) {
        this.deptId = deptId;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public String getRoleId() {
        return roleId;
    }

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

    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserType() {
        return userType;
    }

    public void setUserType(String userType) {
        this.userType = userType;
    }

    public String getEmail() {
        return email;
    }

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

    public String getPhonenumber() {
        return phonenumber;
    }

    public void setPhonenumber(String phonenumber) {
        this.phonenumber = phonenumber;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getAvatar() {
        return avatar;
    }

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

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(String delFlag) {
        this.delFlag = delFlag;
    }

    public String getLoginIp() {
        return loginIp;
    }

    public void setLoginIp(String loginIp) {
        this.loginIp = loginIp;
    }

    public String getLoginDate() {
        return loginDate;
    }

    public void setLoginDate(String loginDate) {
        this.loginDate = loginDate;
    }

    public String getPwdUpdateDate() {
        return pwdUpdateDate;
    }

    public void setPwdUpdateDate(String pwdUpdateDate) {
        this.pwdUpdateDate = pwdUpdateDate;
    }

    public DeptEntity getDept() {
        return dept;
    }

    public void setDept(DeptEntity dept) {
        this.dept = dept;
    }

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

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

    @Override
    public String toString() {
        return "UserEntity{" +
                "userId='" + userId + '\'' +
                ", deptId='" + deptId + '\'' +
                ", parentId='" + parentId + '\'' +
                ", roleId='" + roleId + '\'' +
                ", loginName='" + loginName + '\'' +
                ", userName='" + userName + '\'' +
                ", userType='" + userType + '\'' +
                ", email='" + email + '\'' +
                ", phonenumber='" + phonenumber + '\'' +
                ", sex='" + sex + '\'' +
                ", avatar='" + avatar + '\'' +
                ", password='" + password + '\'' +
                ", salt='" + salt + '\'' +
                ", status='" + status + '\'' +
                ", delFlag='" + delFlag + '\'' +
                ", loginIp='" + loginIp + '\'' +
                ", loginDate='" + loginDate + '\'' +
                ", pwdUpdateDate='" + pwdUpdateDate + '\'' +
                ", dept=" + dept +
                ", roles=" + roles +
                '}';
    }
}
