package com.tandbergtv.metadatamanager.spec;

import java.util.Map;

import com.tandbergtv.metadatamanager.exception.SearchException;
import com.tandbergtv.metadatamanager.model.Asset;
import com.tandbergtv.metadatamanager.specimpl.ttv.TTVId;

/**
 * A spec may have an identifier (single or multiple fields). Each spec
 * identifier must implement this interface and provide the individual fields in
 * the map (consists of field name->value pairs)
 * 
 * @author Demo
 */
public interface IIdentifier {

	/**
	 * Get the asset for the spec specific identifier represented by this
	 * instance.
	 * 
	 * @return
	 */
	Asset getAsset() throws SearchException;
	
	/**
	 * Gets the database id for this asset
	 * @return
	 * @throws SearchException
	 */
	TTVId getAssetTTVId() throws SearchException;

	/**
	 * Returns a map of fields and values which represent the identifier for
	 * this asset in this spec.
	 * 
	 * @return
	 */
	Map<String, String> getSpecIdentifiers();
	
	/**
	 * Sets the id fields and values which represent the identifier for
	 * this asset in this spec.
	 * 
	 * @return
	 */
	void setSpecIdentifiers(Map<String, String> identifiers);	

	/**
	 * Returns a map (spec's xpath->ttv xpath) of the identifying fields.
	 * 
	 * @return
	 */
	Map<String, String> getTTVPaths();
	

	/**
	 * finds out if the identifier has some values 
	 * @return true/false
	 */
	boolean isValidIdentifier();
}
