package eu.dnetlib.enabling.aas.retrievers;

import java.security.InvalidParameterException;

/**
 * Context path data transfer object.
 * 
 * @author mhorst
 *
 */
public class ContextPathDTO {

	/**
	 * Identifier of requested object.
	 */
	private String id;
	
	/**
	 * Identifier xPath location in xml document.
	 */
	private String idPath;
	
	/**
	 * Requested value xPath location.
	 */
	private String valuePath;
	
	/**
	 * Optional profile kind. 
	 */
	private String profileKind;
	
	
	/**
	 * Optional profile type.
	 */
	private String profileType;
	
	/**
	 * Default constructor.
	 * @param id identifier of requested object
	 * @param idPath identifier xPath location in xml document
	 * @param valuePath requested value xPath location
	 */
	public ContextPathDTO(String id, String idPath, String valuePath) {
		this.id = id;
		this.idPath = idPath;
		this.valuePath = valuePath;
	}
	
	/**
	 * Constructor with additional type and kind defined.
	 * @param id identifier of requested object
	 * @param idPath identifier xPath location in xml document
	 * @param valuePath requested value xPath location
	 * @param profileKind profile kind
	 * @param profileType profile type
	 */
	public ContextPathDTO(String id, String idPath, String valuePath,
			String profileKind, String profileType) {
		this.id = id;
		this.idPath = idPath;
		this.valuePath = valuePath;
		if (profileKind!=null && profileType!=null) {
			this.profileKind = profileKind;
			this.profileType = profileType;
		} else if (profileKind==null && profileType==null) {
//			ok
		} else {
			throw new InvalidParameterException("both profileKind and profileType " +
					"have to be either not null or null!");
		}
		
	}
	
	/**
	 * Returns identifier of requested object.
	 * @return identifier of requested object
	 */
	public String getId() {
		return id;
	}

	/**
	 * Sets identifier of requested object.
	 * @param id
	 */
	public void setId(String id) {
		this.id = id;
	}

	/**
	 * Returns identifier xPath location in xml document.
	 * @return identifier xPath location in xml document
	 */
	public String getIdPath() {
		return idPath;
	}

	/**
	 * Sets identifier xPath location in xml document.
	 * @param idPath
	 */
	public void setIdPath(String idPath) {
		this.idPath = idPath;
	}

	/**
	 * Returns requested value xPath location.
	 * @return requested value xPath location
	 */
	public String getValuePath() {
		return valuePath;
	}

	/**
	 * Sets requested value xPath location.
	 * @param valuePath
	 */
	public void setValuePath(String valuePath) {
		this.valuePath = valuePath;
	}

	/**
	 * Returns optional profile kind.
	 * @return optional profile kind
	 */
	public String getProfileKind() {
		return profileKind;
	}

	/**
	 * Returns optional profile type.
	 * @return optional profile type
	 */
	public String getProfileType() {
		return profileType;
	}
	
}
