package meerkat.bulletinboard;

import com.google.common.util.concurrent.FutureCallback;
import meerkat.comm.CommunicationException;
import meerkat.protobuf.BulletinBoardApi.*;

/**
 * Created by Arbel Deutsch Peled on 13-Apr-16.
 * This interface is meant to extend a BulletinBoardClient interface/class
 * It provides it with the ability to delete messages from the Server
 * This assumes the Server implements the  {@link DeletableBulletinBoardServer}
 */
public interface BulletinBoardMessageDeleter {

    /**
     * Deletes a message from a Bulletin Board Server in a possibly asynchronous manner
     * Logs this action
     * @param msgID is the ID of the message to delete
     * @param callback handles the result of the operation
     */
    public void deleteMessage(MessageID msgID, FutureCallback<Boolean> callback);

    /**
     * Deletes a message from the Bulletin Board in a possibly asynchronous manner
     * Logs this action
     * @param entryNum is the serial entry number of the message to delete
     * @param callback handles the result of the operation
     */
    public void deleteMessage(long entryNum, FutureCallback<Boolean> callback);

    /**
     * Deletes a message from a Bulletin Board Server in a synchronous manner
     * Logs this action
     * @param msgID is the ID of the message to delete
     * @return TRUE if the message was deleted and FALSE if it did not exist on the server
     * @throws CommunicationException when an error occurs
     */
    public boolean deleteMessage(MessageID msgID) throws CommunicationException;

    /**
     * Deletes a message from the Bulletin Board in a synchronous manner
     * Logs this action
     * @param entryNum is the serial entry number of the message to delete
     * @return TRUE if the message was deleted and FALSE if it did not exist on the server
     * @throws CommunicationException when an error occurs
     */
    public boolean deleteMessage(long entryNum) throws CommunicationException;

}
