package com.zd.system.api.model;

import java.io.Serializable;
import java.util.Set;

import com.zd.common.core.constant.UserConstants;
import com.zd.system.api.domain.SysUser;

/**
 * 用户信息
 *
 * @author zd
 */
public class LoginUser implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 用户唯一标识
     */
    private String token;
    /**
     * 一体机编号
     */
    private String machineCode;

    /**
     * 用户名id
     */
    private Long userid;

    /**
     * 登录类型区分PC 小程序
     */
    private Integer loginType;

    /**
     * 用户名
     */
    private String username;
    /**
     * 用户名
     */
    private String nickName;

    /**
     * 登录时间
     */
    private Long loginTime;

    /**
     * 过期时间
     */
    private Long expireTime;

    /**
     * 登录IP地址
     */
    private String ipaddr;

    /**
     * 权限列表
     */
    private Set<String> permissions;

    /**
     * 角色列表
     */
    private Set<String> roles;

    /**
     * 用户信息
     */
    private SysUser sysUser;

    /**
     * 是否设置柜锁
     */
    private boolean cabinetLock = false;

    /**
     * 是否设置气瓶
     */
    private boolean airBottle = false;

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public Long getUserid() {
        return userid;
    }

    public void setUserid(Long userid) {
        this.userid = userid;
    }

    public String getUsername() {
        return username;
    }

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

    public Long getLoginTime() {
        return loginTime;
    }

    public void setLoginTime(Long loginTime) {
        this.loginTime = loginTime;
    }

    public Long getExpireTime() {
        return expireTime;
    }

    public void setExpireTime(Long expireTime) {
        this.expireTime = expireTime;
    }

    public String getIpaddr() {
        return ipaddr;
    }

    public void setIpaddr(String ipaddr) {
        this.ipaddr = ipaddr;
    }

    public Set<String> getPermissions() {
        return permissions;
    }

    public void setPermissions(Set<String> permissions) {
        this.permissions = permissions;
    }

    public Set<String> getRoles() {
        return roles;
    }

    public void setRoles(Set<String> roles) {
        this.roles = roles;
    }

    public SysUser getSysUser() {
        return sysUser;
    }

    public void setSysUser(SysUser sysUser) {
        this.sysUser = sysUser;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public Integer getLoginType() {
        if(this.loginType == null){
            return UserConstants.USER_LOGIN_PC;
        }
        return loginType;
    }

    public void setLoginType(Integer loginType) {
        this.loginType = loginType;
    }

    public String getMachineCode() {
        return machineCode;
    }

    public void setMachineCode(String machineCode) {
        this.machineCode = machineCode;
    }

    public boolean isCabinetLock() {
        return cabinetLock;
    }

    public void setCabinetLock(boolean cabinetLock) {
        this.cabinetLock = cabinetLock;
    }

    public boolean isAirBottle() {
        return airBottle;
    }

    public void setAirBottle(boolean airBottle) {
        this.airBottle = airBottle;
    }
}
