package eu.dnetlib.datasource.publisher.model;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import io.swagger.annotations.ApiModel;

/**
 * Api
 */
@JsonAutoDetect
@ApiModel(value = "Datasource Api model", description = "describes the datasource api")
public class Api {

	private String id = null;
	private String typology = null;
	private String compliance;
	private String contentdescription = null;
	private String accessprotocol = null;
	private String baseurl = null;
	private boolean active = false;
	private boolean removable = false;
	private Map<String, String> accessParams = new HashMap<String, String>();
	private Map<String, String> extraFields = new HashMap<String, String>();

	public Api id(String id) {
		this.id = id;
		return this;
	}

	/**
	 * Get id
	 *
	 * @return id
	 **/
	public String getId() {
		return id;
	}

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

	public Api typology(String typology) {
		this.typology = typology;
		return this;
	}

	/**
	 * Get typology
	 *
	 * @return typology
	 **/
	public String getTypology() {
		return typology;
	}

	public void setTypology(String typology) {
		this.typology = typology;
	}

	public Api compliance(String compliance) {
		this.compliance = compliance;
		return this;
	}

	/**
	 * Get typology
	 *
	 * @return typology
	 **/
	public String getCompliance() {
		return compliance;
	}

	public void setCompliance(String compliance) {
		this.compliance = compliance;
	}

	public Api contentdescription(String contentdescription) {
		this.contentdescription = contentdescription;
		return this;
	}

	/**
	 * Get contentdescription
	 *
	 * @return contentdescription
	 **/
	public String getContentdescription() {
		return contentdescription;
	}

	public void setContentdescription(String contentdescription) {
		this.contentdescription = contentdescription;
	}

	public Api accessprotocol(String accessprotocol) {
		this.accessprotocol = accessprotocol;
		return this;
	}

	/**
	 * Get accessprotocol
	 *
	 * @return accessprotocol
	 **/
	public String getAccessprotocol() {
		return accessprotocol;
	}

	public void setAccessprotocol(String accessprotocol) {
		this.accessprotocol = accessprotocol;
	}

	public Api baseurl(String baseurl) {
		this.baseurl = baseurl;
		return this;
	}

	/**
	 * Get baseurl
	 *
	 * @return baseurl
	 **/
	public String getBaseurl() {
		return baseurl;
	}

	public void setBaseurl(String baseurl) {
		this.baseurl = baseurl;
	}

	public Api active(boolean active) {
		this.active = active;
		return this;
	}

	/**
	 * Get active
	 *
	 * @return active
	 **/
	public boolean isActive() {
		return active;
	}

	public void setActive(boolean active) {
		this.active = active;
	}

	public Api removable(boolean removable) {
		this.removable = removable;
		return this;
	}

	/**
	 * Get active
	 *
	 * @return active
	 **/
	public boolean isRemovable() {
		return removable;
	}

	public void setRemovable(boolean removable) {
		this.removable = removable;
	}

	public Api accessParams(Map<String, String> accessParams) {
		this.accessParams = accessParams;
		return this;
	}

	/**
	 * Get active
	 *
	 * @return active
	 **/
	public Map<String, String> getAccessParams() {
		return accessParams;
	}

	public void setAccessParams(Map<String, String> accessParams) {
		this.accessParams = accessParams;
	}

	///

	public Api extraFields(Map<String, String> extraFields) {
		this.extraFields = extraFields;
		return this;
	}

	/**
	 * Get active
	 *
	 * @return active
	 **/
	public Map<String, String> getExtraFields() {
		return extraFields;
	}

	public void setExtraFields(Map<String, String> extraFields) {
		this.extraFields = extraFields;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (o == null || getClass() != o.getClass()) {
			return false;
		}
		Api api = (Api) o;
		return Objects.equals(this.id, api.id) &&
				Objects.equals(this.typology, api.typology) &&
				Objects.equals(this.contentdescription, api.contentdescription) &&
				Objects.equals(this.accessprotocol, api.accessprotocol) &&
				Objects.equals(this.baseurl, api.baseurl);
	}

	@Override
	public int hashCode() {
		return Objects.hash(id, typology, contentdescription, accessprotocol, baseurl);
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("class Api {\n");

		sb.append("    id: ").append(toIndentedString(id)).append("\n");
		sb.append("    typology: ").append(toIndentedString(typology)).append("\n");
		sb.append("    contentdescription: ").append(toIndentedString(contentdescription)).append("\n");
		sb.append("    accessprotocol: ").append(toIndentedString(accessprotocol)).append("\n");
		sb.append("    baseurl: ").append(toIndentedString(baseurl)).append("\n");
		sb.append("}");
		return sb.toString();
	}

	/**
	 * Convert the given object to string with each line indented by 4 spaces
	 * (except the first line).
	 */
	private String toIndentedString(Object o) {
		if (o == null) {
			return "null";
		}
		return o.toString().replace("\n", "\n    ");
	}
}

