package haipham.webnntp.ejb.folder;

import java.rmi.*;
import javax.ejb.*;
import java.util.*;
import haipham.webnntp.ejb.user.User;
import haipham.webnntp.ejb.message.Message;

public interface Folder extends EJBObject{
    /** Add a sub folder. This sub folder will inherit the userName field
     *  from the parent folder.
     */ 
    public Folder addFolder(String folderName, String folderType)
        throws RemoteException;

    /** Return children of this folder (subfolder on 1st level only). */
    public Collection getChildren() throws RemoteException;

    public Message addMessage(String id, String subj, String from, String body)
        throws RemoteException;

    /** Add msg to current folder by setting the Message's folder field 
     * wto this folder
     */
    public Message addMessage(Message m) throws RemoteException;

    /** Return all messages belongs to this folder */
    public Collection getMessages() throws RemoteException; 

    //public int getMessageCount() throws RemoteException;

    // getters
    public long getFolderId() throws RemoteException;
    public String getFolderName() throws RemoteException;
    public String getFolderType() throws RemoteException;
    public Folder getParentFolder() throws RemoteException;
    public User getOwner() throws RemoteException;

    // setters
    public void setFolderName(String name) throws RemoteException;
    public void setFolderType(String type) throws RemoteException;
    public void setParentFolder(Folder folder) throws RemoteException;
    public void setOwner(User owner) throws RemoteException;
}
