package meerkat.crypto.dkg.comm;

import meerkat.protobuf.DKG;

/**
 * Created by talm on 12/04/16.
 */
public class MessageUtils {
    public static DKG.Payload createMessage(DKG.Payload.Type type) {
        return DKG.Payload.newBuilder().setType(type).build();
    }

    public static DKG.Payload createMessage(DKG.Payload.Type type, DKG.ShareMessage share) {
        return DKG.Payload.newBuilder().setType(type).setShare(share).build();
    }

    public static DKG.Payload createMessage(DKG.Payload.Type type, DKG.ShareMessage.Builder share) {
        return DKG.Payload.newBuilder().setType(type).setShare(share).build();
    }

    public static DKG.Payload createMessage(DKG.Payload.Type type, DKG.IDMessage id) {
        return DKG.Payload.newBuilder().setType(type).setId(id).build();
    }

    public static DKG.Payload createMessage(DKG.Payload.Type type, DKG.IDMessage.Builder id) {
        return DKG.Payload.newBuilder().setType(type).setId(id).build();
    }

    public static DKG.Payload createMessage(DKG.Payload.Type type, DKG.CommitmentMessage commitment) {
        return DKG.Payload.newBuilder().setType(type).setCommitment(commitment).build();
    }

    public static DKG.Payload createMessage(DKG.Payload.Type type, DKG.CommitmentMessage.Builder commitment) {
        return DKG.Payload.newBuilder().setType(type).setCommitment(commitment).build();
    }
}
