package com.ecwid.consul.v1.agent.model;

import com.google.gson.annotations.SerializedName;

import java.util.List;

/**
 * @author Vasily Vasilkov (vgv@ecwid.com)
 */
public class NewService {

	public static class Check {
		@SerializedName("Script")
		private String script;
		@SerializedName("Interval")
		private String interval;
		@SerializedName("TTL")
		private String ttl;

		public String getScript() {
			return script;
		}

		public void setScript(String script) {
			this.script = script;
		}

		public String getInterval() {
			return interval;
		}

		public void setInterval(String interval) {
			this.interval = interval;
		}

		public String getTtl() {
			return ttl;
		}

		public void setTtl(String ttl) {
			this.ttl = ttl;
		}

		@Override
		public String toString() {
			return "Check{" +
					"script='" + script + '\'' +
					", interval=" + interval +
					", ttl=" + ttl +
					'}';
		}
	}

	@SerializedName("ID")
	private String id;

	@SerializedName("Name")
	private String name;

	@SerializedName("Tags")
	private List<String> tags;

	@SerializedName("Address")
	private String address;

	@SerializedName("Port")
	private Integer port;

	@SerializedName("Check")
	private Check check;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<String> getTags() {
		return tags;
	}

	public void setTags(List<String> tags) {
		this.tags = tags;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public Integer getPort() {
		return port;
	}

	public void setPort(Integer port) {
		this.port = port;
	}

	public Check getCheck() {
		return check;
	}

	public void setCheck(Check check) {
		this.check = check;
	}

	@Override
	public String toString() {
		return "NewService{" +
				"id='" + id + '\'' +
				", name='" + name + '\'' +
				", tags=" + tags +
				", address='" + address + '\'' +
				", port=" + port +
				", check=" + check +
				'}';
	}
}

@@ -162,12 +162,54 @@
 om)%0A
+ * @author Spencer Gibb (spencer@gibb.us)%0A
  */%0A
-
 publ
@@ -416,16 +416,77 @@
 ing ttl;
+%0A        @SerializedName(%22HTTP%22)%0A        private String http;
 %0A%0A%09%09publ
@@ -845,18 +845,178 @@
 l;%0A%09%09%7D%0A%0A
-%09%09
+        public String getHttp() %7B%0A            return http;%0A        %7D%0A%0A        public void setHttp(String http) %7B%0A            this.http = http;%0A        %7D%0A%0A        
 @Overrid
@@ -1129,24 +1129,24 @@
  interval +%0A
-
 %09%09%09%09%09%22, ttl=
@@ -1151,24 +1151,63 @@
 l=%22 + ttl +%0A
+                    %22, http=%22 + http +%0A
 %09%09%09%09%09'%7D';%0A%09%09

add support for version 0.5 http check