package meerkat.voting.output;

import com.google.common.util.concurrent.FutureCallback;
import meerkat.protobuf.Voting.*;
import meerkat.voting.controller.callbacks.ControllerCallback;

/**
 * An interface for the device in which we output the ballots.
 * Probably going to be a printer or an ethernet connection, or both.
 */
public interface BallotOutputDevice {

    /**
     * Output the encrypted ballot. This is a commitment before voter chooses casting or auditing
     * @param encryptedBallot - the encrypted ballot to commit to
     * @param callback - a callback object which expects no return value
     */
    public void commitToBallot(PlaintextBallot plaintextBallot,
                               SignedEncryptedBallot encryptedBallot,
                               ControllerCallback<Void> callback);

    /**
     * Voter chose 'audit'. Output the ballot secrets to prove correctness of the encryption.
     * @param ballotSecrets - the secrets of the encryption
     * @param callback - a callback object which expects no return value
     */
    public void audit(BallotSecrets ballotSecrets, ControllerCallback<Void> callback);

    /**
     * Voter chose 'cast'. Finalize the ballot for use in the polling station
     * @param callback - a callback object which expects no return value
     */
    public void castBallot(ControllerCallback<Void> callback);

    /**
     * Cancelling the current ballot. This clears the state of the OutputDevice if the implementation has any such state.
     * @param callback - a callback object which expects no return value
     */
    public void cancelBallot(ControllerCallback<Void> callback);

    /**
     * A method for shutting down the Output Device
     */
    public void callShutDown();
}
