package com.ruoyi.system.domain;

import java.util.Date;

public class SysUserOnlineTime {
    private Long id;
    private Long userId;
    private Date onlineDate;
    private Long onlineTime;
    private Date firstLoginTime;
    private Date lastLogoutTime;

    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Long getUserId() {
        return userId;
    }
    public void setUserId(Long userId) {
        this.userId = userId;
    }
    public Date getOnlineDate() {
        return onlineDate;
    }
    public void setOnlineDate(Date onlineDate) {
        this.onlineDate = onlineDate;
    }
    public Long getOnlineTime() {
        return onlineTime;
    }
    public void setOnlineTime(Long onlineTime) {
        this.onlineTime = onlineTime;
    }
    public Date getFirstLoginTime() {
        return firstLoginTime;
    }
    public void setFirstLoginTime(Date firstLoginTime) {
        this.firstLoginTime = firstLoginTime;
    }
    public Date getLastLogoutTime() {
        return lastLogoutTime;
    }
    public void setLastLogoutTime(Date lastLogoutTime) {
        this.lastLogoutTime = lastLogoutTime;
    }
    public void updateUserHeartbeat(Long userId) {
        this.userId = userId;
        this.onlineDate = new Date();
    }
    public void updateOnlineTime(Long onlineTime) {
        this.onlineTime = onlineTime;
    }
    public void updateFirstLoginTime(Date firstLoginTime) {
        this.firstLoginTime = firstLoginTime;
    }
    public void updateLastLogoutTime(Date lastLogoutTime) {
        this.lastLogoutTime = lastLogoutTime;
    }
    public void updateOnlineDate(Date onlineDate) {
        this.onlineDate = onlineDate;
    }
    public String toString() {
        return new StringBuilder()
            .append("id: ").append(id)
            .append(", userId: ").append(userId)
            .append(", onlineDate: ").append(onlineDate)
            .append(", onlineTime: ").append(onlineTime)
            .append(", firstLoginTime: ").append(firstLoginTime)
            .append(", lastLogoutTime: ").append(lastLogoutTime)
            .toString();
    }
}
