package com.eactive.eai.common.sessioninfo;

import com.eactive.eai.common.session.ChannelSessionFacade.LogoutType;

public class SessionHistoryVO {

	public static final String HISTORYDSTCD_LOGIN 		= "LOGIN";
	public static final String HISTORYDSTCD_LOGOUT 		= "LOGOUT";
	public static final String HISTORYDSTCD_DUPLOGIN 	= "DUPLOGIN";
	public static final String HISTORYDSTCD_AUTOLOGOUT 	= "AUTOLOGOUT";
	public static final String HISTORYDSTCD_WEBSOCKET   = "WEBSOCKET";
	public static final String HISTORYDSTCD_FORCELOGOUT = "FORCELOUT";
	public static final String HISTORYDSTCD_WEBSOCKET_TIMEOUT = "WSTIMEOUT";
	public static final String HISTORYDSTCD_DATECHANGE = "DATECHANGE";
	public static final String HISTORYDSTCD_SERVERDOWN = "SERVERDOWN";
	
	public static String convertLogoutType_EnumToString(LogoutType logoutType) {
		
		switch(logoutType) {
		case AutoLogout:
			return SessionHistoryVO.HISTORYDSTCD_AUTOLOGOUT;
		case ForceLogout:
			return SessionHistoryVO.HISTORYDSTCD_FORCELOGOUT;
		case Logout:
			return SessionHistoryVO.HISTORYDSTCD_LOGOUT;
		case WebSocketTimeout:
			return SessionHistoryVO.HISTORYDSTCD_WEBSOCKET_TIMEOUT;
		case DateChange:
			return SessionHistoryVO.HISTORYDSTCD_DATECHANGE;
		case ServerDown:
			return SessionHistoryVO.HISTORYDSTCD_SERVERDOWN;
		default:
			throw new RuntimeException("Fail to convert LogoutTypeEnum : " + logoutType.toString());
        }
		
	}

	private String historyId;
	private String guid;
	private String userId;
	private String uuid;
	private String historyDstcd;
	private String rspnsRsltDvsn;
	private String body;
	private String tranTime;
	private String remoteIp;

	public SessionHistoryVO(String historyId, String guid, String userId, String uuid, String remoteIp, String historyDstcd, String rspnsRsltDvsn, String body, String tranTime) {
		this.historyId = historyId;
		this.guid = guid;
		this.userId = userId;
		this.uuid = uuid;
		this.historyDstcd = historyDstcd;
		this.rspnsRsltDvsn = rspnsRsltDvsn;
		this.body = body;
		this.tranTime = tranTime;
		this.remoteIp = remoteIp;
	}

	public String getHistoryId() {
		return historyId;
	}

	public void setHistoryId(String historyId) {
		this.historyId = historyId;
	}

	public String getGuid() {
		return guid;
	}

	public void setGuid(String guid) {
		this.guid = guid;
	}

	public String getUserId() {
		return userId;
	}

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

	public String getUuid() {
		return uuid;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public String getHistoryDstcd() {
		return historyDstcd;
	}

	public void setHistoryDstcd(String historyDstcd) {
		this.historyDstcd = historyDstcd;
	}

	public String getRspnsRsltDvsn() {
		return rspnsRsltDvsn;
	}

	public void setRspnsRsltDvsn(String rspnsRsltDvsn) {
		this.rspnsRsltDvsn = rspnsRsltDvsn;
	}

	public String getBody() {
		return body;
	}

	public void setBody(String body) {
		this.body = body;
	}

	public String getTranTime() {
		return tranTime;
	}

	public void setTranTime(String tranTime) {
		this.tranTime = tranTime;
	}

	public String getRemoteIp() {
		return remoteIp;
	}

	public void setRemoteIp(String remoteIp) {
		this.remoteIp = remoteIp;
	}

	@Override
	public String toString() {
		return "SessionHistoryVO [historyId=" + historyId + ", guid=" + guid + ", userId=" + userId + ", uuid=" + uuid
				+ ", historyDstcd=" + historyDstcd + ", rspnsRsltDvsn=" + rspnsRsltDvsn + ", body=" + body
				+ ", tranTime=" + tranTime + ", remote=" + remoteIp + "]";
	}


}
