package ru.ulstu.user.model;

import ru.ulstu.odin.model.annotation.OdinCaption;
import ru.ulstu.odin.model.annotation.OdinDate;

import java.util.Date;

public class UserSessionListDto {
    @OdinCaption("Сессия")
    private String sessionId;
    @OdinCaption("Пользователь")
    private String login;
    @OdinCaption("IP адрес")
    private String ipAddress;
    @OdinCaption("Хост")
    private String host;
    @OdinCaption("Вход")
    @OdinDate(type = OdinDate.OdinDateType.DATETIME)
    private Date loginTime;
    @OdinCaption("Выход")
    @OdinDate(type = OdinDate.OdinDateType.DATETIME)
    private Date logoutTime;

    public UserSessionListDto(UserSession userSession) {
        this.sessionId = userSession.getSessionId();
        this.login = userSession.getUser().getLogin();
        this.ipAddress = userSession.getIpAddress();
        this.host = userSession.getHost();
        this.loginTime = userSession.getLoginTime();
        this.logoutTime = userSession.getLogoutTime();
    }

    public String getSessionId() {
        return sessionId;
    }

    public String getLogin() {
        return login;
    }

    public String getIpAddress() {
        return ipAddress;
    }

    public String getHost() {
        return host;
    }

    public Date getLoginTime() {
        return loginTime;
    }

    public Date getLogoutTime() {
        return logoutTime;
    }
}
