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

import com.ecwid.consul.json.Base64TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;

import java.util.Arrays;

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

	@SerializedName("CreateIndex")
	private long createIndex;

	@SerializedName("ModifyIndex")
	private long modifyIndex;

	@SerializedName("LockIndex")
	private Long lockIndex;

	@SerializedName("Flags")
	private long flags;

	@SerializedName("Session")
	private String session;

	@SerializedName("Key")
	private String key;

	@SerializedName("Value")
	private String value;

	public long getCreateIndex() {
		return createIndex;
	}

	public void setCreateIndex(long createIndex) {
		this.createIndex = createIndex;
	}

	public long getModifyIndex() {
		return modifyIndex;
	}

	public void setModifyIndex(long modifyIndex) {
		this.modifyIndex = modifyIndex;
	}

	public Long getLockIndex() {
		return lockIndex;
	}

	public void setLockIndex(Long lockIndex) {
		this.lockIndex = lockIndex;
	}

	public long getFlags() {
		return flags;
	}

	public void setFlags(long flags) {
		this.flags = flags;
	}

	public String getSession() {
		return session;
	}

	public void setSession(String session) {
		this.session = session;
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	@Override
	public String toString() {
		return "GetValue{" +
				"createIndex=" + createIndex +
				", modifyIndex=" + modifyIndex +
				", lockIndex=" + lockIndex +
				", flags=" + flags +
				", session='" + session + '\'' +
				", key='" + key + '\'' +
				", value='" + value + '\'' +
				'}';
	}
}

@@ -47,168 +47,121 @@
 com.
-ecwid.consul.json.Base64TypeAdapter;%0Aimport com.google.gson.annotations.JsonAdapter;%0Aimport com.google.gson.annotations.SerializedName;%0A%0Aimport java.util.Arrays
+google.gson.annotations.SerializedName;%0A%0Aimport javax.xml.bind.DatatypeConverter;%0Aimport java.nio.charset.Charset
 ;%0A%0A/
@@ -1473,16 +1473,326 @@
 ue;%0A%09%7D%0A%0A
+%09public String getDecodedValue(Charset charset) %7B%0A%09%09if (value == null) %7B%0A%09%09%09return null;%0A%09%09%7D%0A%09%09if (charset == null) %7B%0A%09%09%09charset = Charset.forName(%22UTF-8%22);%0A%09%09%7D%0A%09%09return new String(DatatypeConverter.parseBase64Binary(value), charset);%0A%09%7D%0A%0A%09public String getDecodedValue() %7B%0A%09%09return getDecodedValue(null);%0A%09%7D%0A%0A
 %09@Overri

Add convenience function to GetValue to perform base64 decoding. Fixes #60