package i5.las2peer.registry.data;

import java.math.BigInteger;

public class ServiceReleaseData {
	private String serviceName;
	private BigInteger versionMajor;
	private BigInteger versionMinor;
	private BigInteger versionPatch;
	private byte[] signature; // TODO

	public ServiceReleaseData(String serviceName, BigInteger versionMajor, BigInteger versionMinor, BigInteger versionPatch, byte[] signature) {
		this.serviceName = serviceName;
		this.versionMajor = versionMajor;
		this.versionMinor = versionMinor;
		this.versionPatch = versionPatch;
		this.signature = signature;
	}

	public String getServiceName() {
		return serviceName;
	}

	public String getVersion() {
		return versionMajor + "." + versionMinor + "." + versionPatch;
	}

	public Integer getVersionMajor() {
		return versionMajor.intValue();
	}

	public Integer getVersionMinor() {
		return versionMinor.intValue();
	}

	public Integer getVersionPatch() {
		return versionPatch.intValue();
	}

	@Override
	public String toString() {
		return "ServiceReleaseData(service name: " + this.getServiceName() + ", version: " + this.getVersion() + ")";
	}
}

@@ -57,16 +57,67 @@
 Integer;
+%0Aimport java.util.Arrays;%0Aimport java.util.Objects;
 %0A%0Apublic
@@ -1163,11 +1163,667 @@
  %22)%22;%0A%09%7D
+%0A%0A%09@Override%0A%09public boolean equals(Object o) %7B%0A%09%09if (this == o) return true;%0A%09%09if (o == null %7C%7C getClass() != o.getClass()) return false;%0A%09%09ServiceReleaseData that = (ServiceReleaseData) o;%0A%09%09return Objects.equals(serviceName, that.serviceName) &&%0A%09%09%09%09Objects.equals(versionMajor, that.versionMajor) &&%0A%09%09%09%09Objects.equals(versionMinor, that.versionMinor) &&%0A%09%09%09%09Objects.equals(versionPatch, that.versionPatch) &&%0A%09%09%09%09Arrays.equals(signature, that.signature);%0A%09%7D%0A%0A%09@Override%0A%09public int hashCode() %7B%0A%09%09int result = Objects.hash(serviceName, versionMajor, versionMinor, versionPatch);%0A%09%09result = 31 * result + Arrays.hashCode(signature);%0A%09%09return result;%0A%09%7D
 %0A%7D%0A

add release data comparison operators for dup check