/**
 * 
 */
package org.richfaces.realworld.search;

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

import org.richfaces.realworld.domain.Image;
import org.richfaces.realworld.service.ISearchAction;

/**
 * @author Andrey Markavtsov
 *
 */
public class SearchOptionByImage extends ISearchOption {
	
	Map<String, Object> params = new HashMap<String, Object>();
	
	/* (non-Javadoc)
	 * @see org.richfaces.realworld.search.ISearchOption#getName()
	 */
	public String getName() {
		return "Images";
	}
	
	@Override
	public String getSearchResultName() {
		return "Images search result";
	}
	
	@Override
	public void search(ISearchAction action, String q, boolean searchInMyAlbums, boolean searchInShared) {
		List<Image> searchByImage = action.searchByImage(q, searchInMyAlbums, searchInShared);
		setSearchResult(searchByImage);
	}


	/* (non-Javadoc)
	 * @see org.richfaces.realworld.search.ISearchOption#getTemplate()
	 */
	public String getTemplate() {
		return "/includes/search/searchByImageTemplate.xhtml";
	}
	
	@Override
	public String getSearchResultTemplate() {
		return "/includes/search/result/imageResult.xhtml";
	}

	public Map<String, Object> getParams() {
		return params;
	}

	public void setParams(Map<String, Object> params) {
		this.params = params;
	}
	
}