package eu.dnetlib.functionality.webInterface.app;

import java.util.List;
import java.util.Map;

import eu.dnetlib.domain.functionality.Searchable;
import eu.dnetlib.domain.functionality.WebInterfaceLayout;

public interface WebLayoutManager {

	/**
	 * Initialize the web interface layout manager. The lists returned by
	 * {@link #getDetailFields()}, {@link #getSearchFields()}, and
	 * {@link #getSummaryFields()} are also updated.
	 */
	public void init();

	/**
	 * Returns the web layout 
	 * @return
	 */
	public WebInterfaceLayout getLayout();

	/**
	 * Return all the {@link Searchable} searchables. The current layout is 
	 * specified by calling {@link #initialize(String)}.
	 *
	 * @return The detail fileds, ordered by {@link Searchable#getDetailedRank()}
	 */
	public List<Searchable> getAllFields();
	
	/**
	 * Return all the {@link Searchable} searchables in the current layout where
	 * {@link Searchable#isInDetail()} returns <code>true</code>. The
	 * current layout is specified by calling {@link #initialize(String)}.
	 *
	 * @return The detail fileds, ordered by {@link Searchable#getDetailedRank()}
	 */
	public List<Searchable> getDetailFields();

	/**
	 * Return all the {@link Searchable} searchables in the current layout where
	 * {@link Searchable#isInSearch()} returns <code>true</code>. The
	 * current layout is specified by calling {@link #initialize(String)}.
	 *
	 * @return The detail fileds, ordered by {@link Searchable#getSearchRank()}
	 */
	public List<Searchable> getSearchFields();

	/**
	 * Return all the {@link Searchable} searchables in the current layout where
	 * {@link Searchable#isInRefine()} returns <code>true</code>. The
	 * current layout is specified by calling {@link #initialize(String)}.
	 *
	 * @return The detail fileds, ordered by {@link Searchable#getSearchRank()}
	 */
	public List<Searchable> getRefineFields();
	
	/**
	 * Return all the {@link Searchable} searchables in the current layout where
	 * {@link Searchable#isInSummary()} returns <code>true</code>. The
	 * current layout is specified by calling {@link #initialize(String)}.
	 *
	 * @return The detail fileds, ordered by {@link Searchable#getSummaryRank()}
	 */
	public List<Searchable> getSummaryFields();

	/**
	 * Return all the {@link Searchable} searchables in the current layout. The
	 * current layout is specified by calling {@link #initialize(String)}.
	 *
	 * @return All searchables specified in web interface layout
	 */
	public Map<String, Searchable> getLabelMap();

	/**
	 * Return all the {@link Searchable} searchables in the current layout. The
	 * current layout is specified by calling {@link #initialize(String)}. The 
	 * key is the index type 
	 *
	 * @return All searchables specified in web interface layout
	 */	
	public Map<String, Searchable> getIndexMap();
	
	/**
	 * Return all vocabulary names that are needed by {@link Searchable} searchables.
	 * The current layout is specified by calling {@link #initialize(String)}.
	 * @return
	 */
	public List<String> getVocabularyNames();

}

