/**
 * ITitleSearchService.java
 * Created Apr 17, 2008
 * Copyright (c) TANDBERG Television 2007-2008
 */
package com.tandbergtv.watchpoint.pmm.title.search;

import java.util.Collection;

import com.tandbergtv.watchpoint.pmm.entities.Title;
import com.tandbergtv.workflow.core.service.Service;
import com.tandbergtv.workflow.util.SearchCriteria;

/**
 * The search interface facade. This service is responsible for determining which media library to
 * lookup and then performing the actual query in order to locate titles.
 * 
 * @author Sahil Verma
 */
public interface ITitleSearchService extends Service {
	
	/**
	 * Perform a search
	 * 
	 * @param criteria
	 * @return
	 */
	Collection<Title> search(SearchCriteria criteria);
	
	/**
	 * Return the total number of titles that match the search
	 * 
	 * @param criteria
	 * @return
	 */
	int count(SearchCriteria criteria);
	
	/**
	 * Returns the list of matching titles as well as the total number of matches. This is useful
	 * when the search criteria explicitly contain the maximum number of titles to return.
	 * 
	 * Note that this implies two queries in the worst case, one for matches and one for the count.
	 * Therefore if the list of matched titles alone is required, call search() instead.
	 * 
	 * @param criteria
	 * @return
	 */
	TitleSearchResult getSearchResult(SearchCriteria criteria);
}
