package cn.estsh.i3plus.pojo.platform.bean;

import io.swagger.annotations.ApiParam;
import lombok.Data;

import java.io.Serializable;

/**
 * @Description : 操作人对象，用于登陆，非持久化
 * @Reference :
 * @Author : alwaysfrin
 * @CreateDate : 2018-09-04 15:58
 * @Modify:
 **/
@Data
public class SessionUser implements Serializable {

    private static final long serialVersionUID = -6478598185766500419L;

    @ApiParam("会话ID")
    private String token;

    @ApiParam("用户ID")
    private Long userId;

    @ApiParam("设备ID")
    private String deviceId;

    @ApiParam("用户工号")
    private String userCode;

    @ApiParam("用户姓名")
    private String userName;

    @ApiParam("语言代码")
    private String languageCode;

    //CommonEnumUtil.USER_TYPE.xxx.getCode()
    @ApiParam("用户类型")
    private String userType;

    @ApiParam("用户登录平台")
    private Integer loginPlatform;

    @ApiParam("用户信息")
    private SysUser user;

    @ApiParam("用户对象信息")
    private SysUserInfo userInfo;

    @ApiParam("列表默认分页数量配置")
    private Integer[] pageSizeArray;

    @ApiParam("列表默认分页数量")
    private Integer pageDefaultSize;

    @ApiParam("文件展示地址")
    private String fileViewUrl;

    public SessionUser() {
    }

    public SessionUser(String userCode, String userName, String organizeCode) {
        this.userCode = userCode;
        this.userName = userName;
        SysUserInfo sysUserInfo = new SysUserInfo();
        sysUserInfo.setOrganizeCode(organizeCode);
        this.userInfo = sysUserInfo;
    }

    public SessionUser(String userCode, String userName, String siteCode, String languageCode, String userTypeId) {
        this.userCode = userCode;
        this.userName = userName;
        this.languageCode = languageCode;
        this.userType = userTypeId;
    }

    /**
     * 不建议使用， 推荐使用 AuthUtil.getDeviceId(); 方法
     * @return
     */
    @Deprecated
    public String getDeviceId() {
        return deviceId;
    }
}
