package com.libreecm.commonAPI.model.objects;


import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.libreecm.commonAPI.model.enums.BaseTypeId;
import com.libreecm.commonAPI.model.enums.Event;
import com.libreecm.commonAPI.model.enums.PropertyIds;


@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class Policy extends LibreECMDataObject  {

	/**
	 * 
	 */
	@JsonIgnore
	private static final long serialVersionUID = 3058239867666663200L;
	private String text;
	private Event event;
	private String origen;
	private String destination;

	/**
	 * @return the event
	 */
	public Event getEvent() {
		return event;
	}
	/**
	 * @param event the event to set
	 */
	public void setEvent(Event event) {
		if (event==null) return;
		addStringProperty("cmis:event",event.value());
		this.event = event;
	}
	/**
	 * @return the origen
	 */
	public String getOrigen() {
		return origen;
	}
	/**
	 * @param origen the origen to set
	 */
	public void setOrigen(String origen) {
		if (origen==null)return;
		addStringProperty(PropertyIds.SOURCE_ID, origen.toString());
		this.origen = origen;
	}
	/**
	 * @return the destination
	 */
	public String getDestination() {
		return destination;
	}
	/**
	 * @param destination the destination to set
	 */
	public void setDestination(String destination) {
		if (destination==null) return;
		addStringProperty(PropertyIds.TARGET_ID,destination.toString());
		this.destination = destination;
	}
	/**
	 * @return the text
	 */
	public String getText() {
		return text;
	}
	/**
	 * @param text the text to set
	 */
	public void setText(String text) {
		if (text==null) return;
		addStringProperty(PropertyIds.POLICY_TEXT, text);
		this.text = text;
	}

	public Policy(){
		super();
		//For jackson, setObjectType SHOULD be called first
		super.setObjectType(new PolicyObjectType());
		super.setBaseTypeId(BaseTypeId.CMIS_POLICY);
	}


	public Policy(Uri uri, ObjectType objectType){
		super(uri, objectType);
	}
}
