package cz.muni.fi.lasaris.sbms.api.entities;

import javax.xml.bind.annotation.XmlRootElement;

import org.apache.commons.lang3.StringEscapeUtils;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;

@XmlRootElement
@JsonInclude(JsonInclude.Include.NON_NULL)
public class DataPoint {
	private String bmsId;
	private String type;
	
	private Source source;
	private Scope scope;
	private Sensing sensing;
	private ObservedProperty property;
	
	private Influence influence;
	
	@JsonIgnore
	private String group;
	
	public DataPoint() {
	}
	
	public static String getResourceId(String bmsId) {
		return StringEscapeUtils.escapeXml10(bmsId);
	}
	
	@JsonIgnore
	public String getResourceId() {
		return DataPoint.getResourceId(this.bmsId);
	}
	
	public DataPoint(String bmsId) {
		this.bmsId = bmsId;
	}
	
	public DataPoint(String bmsId, String dataPointType) {
		this.bmsId = bmsId;
		this.type = dataPointType;
	}
	
	public Source getSource() {
		return source;
	}
	
	public void setSource(Source source) {
		this.source = source;
	}

	public Scope getScope() {
		return scope;
	}

	public void setScope(Scope scope) {
		this.scope = scope;
	}

	public Sensing getSensing() {
		return sensing;
	}

	public void setSensing(Sensing sensing) {
		this.sensing = sensing;
	}

	public ObservedProperty getProperty() {
		return property;
	}

	public void setProperty(ObservedProperty property) {
		this.property = property;
	}

	public Influence getInfluence() {
		return influence;
	}

	public void setInfluence(Influence influence) {
		this.influence = influence;
	}
	
	public String getBmsId() {
		return bmsId;
	}
	public void setBmsId(String bmsId) {
		this.bmsId = bmsId;
	}
	public String getType() {
		return type;
	}
	public void setType(String dataPointType) {
		this.type = dataPointType;
	}

	public String getGroup() {
		return group;
	}

	public void setGroup(String group) {
		this.group = group;
	}

	@Override
	public String toString() {
		return "DataPoint [bmsId=" + bmsId + ", dataPointType=" + type + ", source=" + source + ", scope="
				+ scope + ", sensing=" + sensing + ", property=" + property + ", influence=" + influence + "]";
	}
}
