package com.eactive.eai.flowcontrol.jms;

import java.io.Serializable;

public class QueueMonitorVO implements Serializable {

	private static final long serialVersionUID = 1L;

	private String queueName; 			// Queue Name

	private long   currentCount; 		// 모니터링 현재값
	private long   previousCount; 		// 모니터링 이전값
	private long   maxCount; 			// EAI큐임계치값

	private String queBzwkCtnt; 		// EAI큐업무내용
	private String queUseYn; 			// 큐사용여부
	private String queUsagDstcd; 		// 큐용도구분코드
	private String bzwkDstcd;			// EAI업무구분코드
	private String queBzwkDtalsCtnt;	// EAI큐업무세부내용
	private String sevrInstncName; 		// EAI서버인스턴스명

	public QueueMonitorVO(String qName, long max) {
		queueName = qName;
		currentCount = 0;
		previousCount = 0;
		maxCount = max;
	}

	public long getCurrentCount() {
		return currentCount;
	}

	public void setCurrentCount(long currentCount) {
		this.previousCount = this.currentCount;
		this.currentCount = currentCount;
	}

	public long getMaxCount() {
		return maxCount;
	}

	public void setMaxCount(long maxCount) {
		this.maxCount = maxCount;
	}

	public long getPreviousCount() {
		return previousCount;
	}

	public void setPreviousCount(long previousCount) {
		this.previousCount = previousCount;
	}

	public String getQueueName() {
		return queueName;
	}

	public void setQueueName(String queueName) {
		this.queueName = queueName;
	}

	public int checkCount() {
		int status = 0; // 정상상태

		// 이상 Alert
		if ((previousCount < maxCount) && (currentCount >= maxCount)) {
			status = 1;
		}
		// 이상상태 계속
		else if ((previousCount >= maxCount) && (currentCount >= maxCount)) {
			status = 2;
		}
		// 이상상태 복구 Alert
		else if ((previousCount >= maxCount) && (currentCount < maxCount)) {
			status = 3;
		}

		return status;
	}

	public String getBzwkDstcd() {
		return bzwkDstcd;
	}

	public void setBzwkDstcd(String bzwkDstcd) {
		this.bzwkDstcd = bzwkDstcd;
	}

	public String getQueBzwkCtnt() {
		return queBzwkCtnt;
	}

	public void setQueBzwkCtnt(String queBzwkCtnt) {
		this.queBzwkCtnt = queBzwkCtnt;
	}

	public String getQueBzwkDtalsCtnt() {
		return queBzwkDtalsCtnt;
	}

	public void setQueBzwkDtalsCtnt(String queBzwkDtalsCtnt) {
		this.queBzwkDtalsCtnt = queBzwkDtalsCtnt;
	}

	public String getQueUsagDstcd() {
		return queUsagDstcd;
	}

	public void setQueUsagDstcd(String queUsagDstcd) {
		this.queUsagDstcd = queUsagDstcd;
	}

	public String getQueUseYn() {
		return queUseYn;
	}

	public void setQueUseYn(String queUseYn) {
		this.queUseYn = queUseYn;
	}

	public String getSevrInstncName() {
		return sevrInstncName;
	}

	public void setSevrInstncName(String sevrInstncName) {
		this.sevrInstncName = sevrInstncName;
	}

	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("queueName=").append(queueName).append(",");
		sb.append("currentCount=").append(currentCount).append(",");
		sb.append("previousCount=").append(previousCount).append(",");
		sb.append("maxCount=").append(maxCount).append(",");
		sb.append("queBzwkCtnt=").append(queBzwkCtnt).append(",");
		sb.append("queUseYn=").append(queUseYn).append(",");
		sb.append("queUsagDstcd=").append(queUsagDstcd).append(",");
		sb.append("bzwkDstcd=").append(bzwkDstcd).append(",");
		sb.append("queBzwkDtalsCtnt=").append(queBzwkDtalsCtnt).append(",");
		sb.append("sevrInstncName=").append(sevrInstncName);
		return sb.toString();
	}

}
