package org.vasttrafik.wso2.carbon.apimgt.portal.api.beans;

import java.util.Date;
import java.util.List;
import org.codehaus.jackson.annotate.JsonProperty;

/**
 *
 * @author Daniel Oskarsson <daniel.oskarsson@gmail.com>
 */
public class API {

	public enum Transport {

		@JsonProperty("http")
		HTTP,
		@JsonProperty("https")
		HTTPS
	}

	public enum Visibility {

		@JsonProperty("public")
		PUBLIC,
		@JsonProperty("private")
		PRIVATE

	}

	private String name;
	private String description;
	private String imageUrl;
	private String context;
	private String version;
	private String provider;
	private String swagger;
	private String status;
	private String responseCaching;
	private Date lastModifiedDate;
	private Boolean isDefaultVersion;
	private List<Transport> transports;
	private String tier;
	private Visibility visibility;
	private Endpoint endpoint;

	public API() {
	}

	public API(String name, String context, String version) {
		this.name = name;
		this.context = context;
		this.version = version;
	}

	// Computed property
	public String getId() {
		return String.format("%s-%s-%s", name, version, this.provider != null ? this.provider : "null");
	}

	public String getName() {
		return name;
	}

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

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getImageUrl() {
		return imageUrl;
	}

	public void setImageUrl(String imageUrl) {
		this.imageUrl = imageUrl;
	}

	public String getContext() {
		return context;
	}

	public void setContext(String context) {
		this.context = context;
	}

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

	public String getProvider() {
		return provider;
	}

	public void setProvider(String provider) {
		this.provider = provider;
	}

	public String getSwagger() {
		return swagger;
	}

	public void setSwagger(String swagger) {
		this.swagger = swagger;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getResponseCaching() {
		return responseCaching;
	}

	public void setResponseCaching(String responseCaching) {
		this.responseCaching = responseCaching;
	}

	public Date getLastModifiedDate() {
		return lastModifiedDate;
	}

	public void setLastModifiedDate(Date lastModifiedDate) {
		this.lastModifiedDate = lastModifiedDate;
	}

	public Boolean getIsDefaultVersion() {
		return isDefaultVersion;
	}

	public void setIsDefaultVersion(Boolean isDefaultVersion) {
		this.isDefaultVersion = isDefaultVersion;
	}

	public List<Transport> getTransports() {
		return transports;
	}

	public void setTransports(List<Transport> transport) {
		this.transports = transport;
	}

	public String getTier() {
		return tier;
	}

	public void setTier(String tier) {
		this.tier = tier;
	}

	public Visibility getVisibility() {
		return visibility;
	}

	public void setVisibility(Visibility visibility) {
		this.visibility = visibility;
	}

	public Endpoint getEndpoint() {
		return endpoint;
	}

	public void setEndpoint(Endpoint endpoint) {
		this.endpoint = endpoint;
	}

}

@@ -339,113 +339,8 @@
 %09%7D%0A%0A
-%09public enum Visibility %7B%0A%0A%09%09@JsonProperty(%22public%22)%0A%09%09PUBLIC,%0A%09%09@JsonProperty(%22private%22)%0A%09%09PRIVATE%0A%0A%09%7D%0A%0A
 %09pri
@@ -700,40 +700,8 @@
 er;%0A
-%09private Visibility visibility;%0A
 %09pri
@@ -2828,158 +2828,8 @@
 %09%7D%0A%0A
-%09public Visibility getVisibility() %7B%0A%09%09return visibility;%0A%09%7D%0A%0A%09public void setVisibility(Visibility visibility) %7B%0A%09%09this.visibility = visibility;%0A%09%7D%0A%0A
 %09pub

Remove visibility property from bean