package org.kne.cloud.network.klalb;

import java.net.InetAddress;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

import org.kne.cloud.network.MultiProtocolSocketAddress;

public class KLALBControllerConfigItem extends KLALBConfigItem {
	private String language;
	private boolean nogui;
	private String VirtualAddress=KLALBUtils.randomKLALBIPv6Address().toString();
	private Long VirtualASN;
	private List<InetAddress> DNS;
	private MultiProtocolSocketAddress TCPListen=new MultiProtocolSocketAddress("0.0.0.0",4565);
	private MultiProtocolSocketAddress UDPListen=new MultiProtocolSocketAddress("udp","0.0.0.0",4565);
	private String VirtualSocketName=CONST.KLTP_VIRTUAL_SOCKET_NAME;
	private List<MultiProtocolSocketAddress>LineTable=new ArrayList<>();
	private List<MultiProtocolSocketAddress>ConnectLineTable=new ArrayList<>();
	private List<MultiProtocolSocketAddress>ntpServerTable=new ArrayList<>();
	private boolean denyLineTableQuery=false;
	private boolean denyLineTableBroadcast=false;
	private String congestionAlgorithm="BBR";
	private double burstLimit=1.50;
	private double delayUpperBound=1.20;
	private double delayLowerBound=1.15;
	private long nagleDelayTime=1000000L;
	private long linkNagleDelayTime=1000000L;
	private int linkConnectionsCount=1;
	private String TUNName=CONST.KLALB_S_RV6;
	private String performanceStrategy="multifill";

	public String getPerformanceStrategy() {
		return performanceStrategy;
	}

	public void setPerformanceStrategy(String performanceStrategy) {
		this.performanceStrategy = performanceStrategy;
	}

	public void setNetworkInterfaceExcepts(List<String> networkInterfaceExcepts) {
		NetworkInterfaceExcepts = networkInterfaceExcepts;
	}



	private List<String>NetworkInterfaceExcepts=new ArrayList<>();
	
	



	public List<String> getNetworkInterfaceExcepts() {
		return NetworkInterfaceExcepts;
	}


	public void setLanguage(String language) {
		this.language = language;
	}



	public KLALBControllerConfigItem() {
		super("KLALBController");
	}

	

	public String getLanguage() {
		return language;
	}



	public String getVirtualSocketName() {
		return VirtualSocketName;
	}



	public void setVirtualSocketName(String virtualSocketName) {
		VirtualSocketName = virtualSocketName;
	}



	public boolean isNogui() {
		return nogui;
	}



	public void setNogui(boolean nogui) {
		this.nogui = nogui;
	}



	public String getVirtualAddress() {
		return VirtualAddress;
	}



	public void setVirtualAddress(String virtualAddress) {
		VirtualAddress = virtualAddress;
	}



	public Long getVirtualASN() {
		return VirtualASN;
	}



	public void setVirtualASN(Long virtualASN) {
		VirtualASN = virtualASN;
	}



	public List<InetAddress> getDNS() {
		return DNS;
	}



	public void setDNS(List<InetAddress> dNS) {
		DNS = dNS;
	}



	public MultiProtocolSocketAddress getTCPListen() {
		return TCPListen;
	}



	public void setTCPListen(MultiProtocolSocketAddress tCPListen) {
		TCPListen = tCPListen;
	}



	public MultiProtocolSocketAddress getUDPListen() {
		return UDPListen;
	}



	public void setUDPListen(MultiProtocolSocketAddress uDPListen) {
		UDPListen = uDPListen;
	}



	public List<MultiProtocolSocketAddress> getLineTable() {
		return LineTable;
	}



	public void setLineTable(List<MultiProtocolSocketAddress> lineTable) {
		LineTable = lineTable;
	}



	public List<MultiProtocolSocketAddress> getConnectLineTable() {
		return ConnectLineTable;
	}



	public void setConnectLineTable(List<MultiProtocolSocketAddress> connectLineTable) {
		ConnectLineTable = connectLineTable;
	}

	

	public List<MultiProtocolSocketAddress> getNtpServerTable() {
		return ntpServerTable;
	}




	public void setNtpServerTable(List<MultiProtocolSocketAddress> ntpServerTable) {
		this.ntpServerTable = ntpServerTable;
	}

	





	public String getCongestionAlgorithm() {
		return congestionAlgorithm;
	}




	public void setCongestionAlgorithm(String congestionAlgorithm) {
		this.congestionAlgorithm = congestionAlgorithm;
	}


	

	
	
	public double getBurstLimit() {
		return burstLimit;
	}


	public void setBurstLimit(double burstLimit) {
		this.burstLimit = burstLimit;
	}


	public double getDelayUpperBound() {
		return delayUpperBound;
	}




	public void setDelayUpperBound(double delayUpperBound) {
		this.delayUpperBound = delayUpperBound;
	}




	public double getDelayLowerBound() {
		return delayLowerBound;
	}




	public void setDelayLowerBound(double delayLowerBound) {
		this.delayLowerBound = delayLowerBound;
	}
	



	public boolean isDenyLineTableQuery() {
		return denyLineTableQuery;
	}


	public void setDenyLineTableQuery(boolean denyLineTableQuery) {
		this.denyLineTableQuery = denyLineTableQuery;
	}


	public boolean isDenyLineTableBroadcast() {
		return denyLineTableBroadcast;
	}


	public void setDenyLineTableBroadcast(boolean denyLineTableBroadcast) {
		this.denyLineTableBroadcast = denyLineTableBroadcast;
	}


	public long getNagleDelayTime() {
		return nagleDelayTime;
	}


	public void setNagleDelayTime(long nagleDelayTime) {
		this.nagleDelayTime = nagleDelayTime;
	}

	
	public int getLinkConnectionsCount() {
		return linkConnectionsCount;
	}

	

	public void setLinkConnectionsCount(int linkConnectionsCount) {
		this.linkConnectionsCount = linkConnectionsCount;
	}

	
	public long getLinkNagleDelayTime() {
		return linkNagleDelayTime;
	}


	public void setLinkNagleDelayTime(long linkNagleDelayTime) {
		this.linkNagleDelayTime = linkNagleDelayTime;
	}


	public String getTUNName() {
		return TUNName;
	}


	public void setTUNName(String tUNName) {
		TUNName = tUNName;
	}


	@Override
	public String toString() {
		return "KLALBControllerConfigItem{" +
				"language='" + language + '\'' +
				", nogui=" + nogui +
				", VirtualAddress='" + VirtualAddress + '\'' +
				", VirtualASN=" + VirtualASN +
				", DNS=" + DNS +
				", TCPListen=" + TCPListen +
				", UDPListen=" + UDPListen +
				", VirtualSocketName='" + VirtualSocketName + '\'' +
				", LineTable=" + LineTable +
				", ConnectLineTable=" + ConnectLineTable +
				", ntpServerTable=" + ntpServerTable +
				", denyLineTableQuery=" + denyLineTableQuery +
				", denyLineTableBroadcast=" + denyLineTableBroadcast +
				", congestionAlgorithm='" + congestionAlgorithm + '\'' +
				", burstLimit=" + burstLimit +
				", delayUpperBound=" + delayUpperBound +
				", delayLowerBound=" + delayLowerBound +
				", nagleDelayTime=" + nagleDelayTime +
				", linkNagleDelayTime=" + linkNagleDelayTime +
				", linkConnectionsCount=" + linkConnectionsCount +
				", TUNName='" + TUNName + '\'' +
				", performanceStrategy='" + performanceStrategy + '\'' +
				", NetworkInterfaceExcepts=" + NetworkInterfaceExcepts +
				'}';
	}

	@Override
	public boolean equals(Object o) {
		if (o == null || getClass() != o.getClass()) return false;
		if (!super.equals(o)) return false;
		KLALBControllerConfigItem that = (KLALBControllerConfigItem) o;
		return nogui == that.nogui && denyLineTableQuery == that.denyLineTableQuery && denyLineTableBroadcast == that.denyLineTableBroadcast && Double.compare(burstLimit, that.burstLimit) == 0 && Double.compare(delayUpperBound, that.delayUpperBound) == 0 && Double.compare(delayLowerBound, that.delayLowerBound) == 0 && nagleDelayTime == that.nagleDelayTime && linkNagleDelayTime == that.linkNagleDelayTime && linkConnectionsCount == that.linkConnectionsCount && Objects.equals(language, that.language) && Objects.equals(VirtualAddress, that.VirtualAddress) && Objects.equals(VirtualASN, that.VirtualASN) && Objects.equals(DNS, that.DNS) && Objects.equals(TCPListen, that.TCPListen) && Objects.equals(UDPListen, that.UDPListen) && Objects.equals(VirtualSocketName, that.VirtualSocketName) && Objects.equals(LineTable, that.LineTable) && Objects.equals(ConnectLineTable, that.ConnectLineTable) && Objects.equals(ntpServerTable, that.ntpServerTable) && Objects.equals(congestionAlgorithm, that.congestionAlgorithm) && Objects.equals(TUNName, that.TUNName) && Objects.equals(performanceStrategy, that.performanceStrategy) && Objects.equals(NetworkInterfaceExcepts, that.NetworkInterfaceExcepts);
	}

	@Override
	public int hashCode() {
		return Objects.hash(super.hashCode(), language, nogui, VirtualAddress, VirtualASN, DNS, TCPListen, UDPListen, VirtualSocketName, LineTable, ConnectLineTable, ntpServerTable, denyLineTableQuery, denyLineTableBroadcast, congestionAlgorithm, burstLimit, delayUpperBound, delayLowerBound, nagleDelayTime, linkNagleDelayTime, linkConnectionsCount, TUNName, performanceStrategy, NetworkInterfaceExcepts);
	}
}
