package io.spacedog.client.admin;

import java.util.List;
import java.util.Set;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.google.common.collect.Sets;

import io.spacedog.client.data.DataObjectBase;
import io.spacedog.client.data.DataWrap;
import io.spacedog.client.data.DataWrapAbstract;
import io.spacedog.client.schema.Schema;

@JsonIgnoreProperties(ignoreUnknown = true)
public class Backend extends DataObjectBase {

	public enum Type {
		standard, dedicated
	}

	public final static String TYPE = "backend";

	public String name;
	public Type type;
	public String version;
	public Set<String> customers = Sets.newHashSet();

	public Backend() {
	}

	public static Schema schema() {
		return Schema.builder(TYPE)//
				.keyword("name")//
				.keyword("type")//
				.keyword("version")//
				.keyword("customers")//
				.build();
	}

	@JsonIgnoreProperties(ignoreUnknown = true)
	public static class Wrap extends DataWrapAbstract<Backend> {

		private Backend source;

		@Override
		public Class<Backend> sourceClass() {
			return Backend.class;
		}

		@Override
		public Backend source() {
			return this.source;
		}

		@Override
		public DataWrap<Backend> source(Backend source) {
			this.source = source;
			return this;
		}
	}

	@JsonIgnoreProperties(ignoreUnknown = true)
	public static class Results {
		public long total;
		public List<Backend.Wrap> results;
	}
}
@@ -54,30 +54,8 @@
 ist;
-%0Aimport java.util.Set;
 %0A%0Aim
@@ -117,47 +117,8 @@
 ies;
-%0Aimport com.google.common.collect.Sets;
 %0A%0Aim
@@ -482,29 +482,8 @@
 %22;%0A%0A
-%09public String name;%0A
 %09pub
@@ -524,59 +524,8 @@
 ion;
-%0A%09public Set%3CString%3E customers = Sets.newHashSet();
 %0A%0A%09p
@@ -615,31 +615,8 @@
 )//%0A
-%09%09%09%09.keyword(%22name%22)//%0A
 %09%09%09%09
@@ -664,36 +664,8 @@
 )//%0A
-%09%09%09%09.keyword(%22customers%22)//%0A
 %09%09%09%09

Refactor Backend class