/*
 * Copyright 2018 Scytl Secure Electronic Voting SA
 *
 * All rights reserved
 *
 * See our extended copyright notice in *file 'Copyright.txt' which is part of this source code package
 */
package com.scytl.products.ov.mixnet.commons.beans.proofs;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.scytl.products.ov.mixnet.commons.proofs.bg.commitments.PrivateCommitment;
import com.scytl.products.ov.mixnet.commons.proofs.bg.commitments.PublicCommitment;

/**
 * Encapsulates the initial message generated by a {@link SingleValueProductProofGenerator}.
 */
public final class SingleValueProductProofInitialMessage {

    private final PublicCommitment cd;

    private final PublicCommitment commitmentPublicLowDelta;

    private final PublicCommitment commitmentPublicHighDelta;

    @JsonCreator
    public SingleValueProductProofInitialMessage(@JsonProperty("commitmentPublicD") final PublicCommitment cd,
            @JsonProperty("commitmentPublicLowDelta") final PublicCommitment cdelta,
            @JsonProperty("commitmentPublicHighDelta") final PublicCommitment cDelta) {
        this.cd = cd;
        commitmentPublicLowDelta = cdelta;
        commitmentPublicHighDelta = cDelta;
    }

    public SingleValueProductProofInitialMessage(final PrivateCommitment cd, final PrivateCommitment cdelta,
            final PrivateCommitment cDelta) {

    	this.cd = cd.makePublicCommitment();
        commitmentPublicLowDelta = cdelta.makePublicCommitment();
        commitmentPublicHighDelta = cDelta.makePublicCommitment();

    }

    /**
     * @return Returns the cd.
     */
    public PublicCommitment getCommitmentPublicD() {
        return cd;
    }

    /**
     * @return Returns the cdelta.
     */
    public PublicCommitment getCommitmentPublicLowDelta() {
        return commitmentPublicLowDelta;
    }

    /**
     * @return Returns the cDelta.
     */
    public PublicCommitment getCommitmentPublicHighDelta() {
        return commitmentPublicHighDelta;
    }

    @Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("SingleValueProductProofInitialMessage [cd=");
		builder.append(cd);
		builder.append(", commitmentPublicLowDelta=");
		builder.append(commitmentPublicLowDelta);
		builder.append(", commitmentPublicHighDelta=");
		builder.append(commitmentPublicHighDelta);
		builder.append("]");
		return builder.toString();
	}

}
