package org.yacos.core.article;

import java.util.ArrayList;
import java.util.List;

import javax.ejb.Remote;

import org.yacos.core.article.Article.State;
import org.yacos.core.article.Preference.PreferenceType;
import org.yacos.core.conferences.Conference;
import org.yacos.core.exceptions.ConferenceDoesntExistException;



@Remote
public interface IArticleManager {
	public Article getArticle(Integer id);
	public Article addArticle(String title, String topic, String abstractText, String url_article, 
			String mainauthor, ArrayList<String> secondaryAuthor, State state,Integer integer);
	public void removeArticle(Integer articleId);
	public void updateArticle(Article article);
	public Integer countArticle(Integer confId);
	
	
	
	//liste d'articles
	
	//public List<Article> getArticles();
	/*
	 * Return all the articles of an author
	 */
	public List<Article> getArticleOfAuthor(String authorId);
	
	public List<Article> getArticles(Integer confId) throws ConferenceDoesntExistException;
	public List<Article> getArticleOfAuthor(Integer confId, String authorId);
	public List<Article> getArticlesOfMember(Integer confId, String memberId);
	//public List<Article> getAllArticles();
	
	/*
	 * return the conference which own the article
	 */
	public Conference getConferenceForArticle(Integer articleId);
	
	
	//gestion des preferences
	public Preference addPreference(Integer articleId, String userLogin, PreferenceType preferenceType);
	public void updatePreference(Preference preference);
	public void removePreference(Integer articleId, String userLogin);
	public Preference getPreferenceForUserAndArticle(Integer articleId, String pcMemberLogin);
	public List<Preference> getPreferencesForArticle(Integer articleId);
	
	//delegation
	public void assignArticleToPCMember(Integer articleId,String memberId);
	public void unassignArticleToPCMember(Integer articleId,String memberId);
	public void delegateArticleToReferee(Integer articleId, String refereeId, String memberId);
	public void undelegateArticleToReferee(Integer articleId, String refereeId, String memberId);
	
	public boolean existsArticle(Integer articleId);
	public boolean existsPreference(Preference preference);
	public void addOrUpdatePreference(int id, String login,
			PreferenceType preferenceType);
		
}
