package com.eactive.eai.common.inflow;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@SuppressWarnings("serial")
public class InflowGroupVO implements Serializable {
	private String groupId;
	private String groupName;
	private long thresholdPerSecond;
	private long threshold;
	private String thresholdTimeUnit;
	private boolean activate;
	private List<String> interfaceList = new ArrayList<>();

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof InflowGroupVO) {
			return groupId.equals(((InflowGroupVO) obj).getGroupId());
		}
		return false;
	}

	@Override
	public int hashCode() {
		return groupId != null ? groupId.hashCode() : 0;
	}

	public String getGroupId() {
		return groupId;
	}

	public void setGroupId(String groupId) {
		this.groupId = groupId;
	}

	public String getGroupName() {
		return groupName;
	}

	public void setGroupName(String groupName) {
		this.groupName = groupName;
	}

	public long getThresholdPerSecond() {
		return thresholdPerSecond;
	}

	public void setThresholdPerSecond(long thresholdPerSecond) {
		this.thresholdPerSecond = thresholdPerSecond;
	}

	public long getThreshold() {
		return threshold;
	}

	public void setThreshold(long threshold) {
		this.threshold = threshold;
	}

	public String getThresholdTimeUnit() {
		return thresholdTimeUnit;
	}

	public void setThresholdTimeUnit(String thresholdTimeUnit) {
		this.thresholdTimeUnit = thresholdTimeUnit;
	}

	public boolean isActivate() {
		return activate;
	}

	public void setActivate(boolean activate) {
		this.activate = activate;
	}

	public List<String> getInterfaceList() {
		return interfaceList;
	}

	public void setInterfaceList(List<String> interfaceList) {
		this.interfaceList = interfaceList;
	}

	public void addInterface(String interfaceId) {
		if (this.interfaceList == null) {
			this.interfaceList = new ArrayList<>();
		}
		this.interfaceList.add(interfaceId);
	}

	@Override
	public String toString() {
		return "InflowGroupVO [groupId=" + groupId + ", groupName=" + groupName
				+ ", thresholdPerSecond=" + thresholdPerSecond
				+ ", threshold=" + threshold
				+ ", thresholdTimeUnit=" + thresholdTimeUnit
				+ ", activate=" + activate
				+ ", interfaceCount=" + (interfaceList != null ? interfaceList.size() : 0) + "]";
	}
}
