// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.logic.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;

/** The AS2 agreement validation settings. */
@Fluent
public final class AS2ValidationSettings {
    /*
     * The value indicating whether to override incoming message properties with those in agreement.
     */
    @JsonProperty(value = "overrideMessageProperties", required = true)
    private boolean overrideMessageProperties;

    /*
     * The value indicating whether the message has to be encrypted.
     */
    @JsonProperty(value = "encryptMessage", required = true)
    private boolean encryptMessage;

    /*
     * The value indicating whether the message has to be signed.
     */
    @JsonProperty(value = "signMessage", required = true)
    private boolean signMessage;

    /*
     * The value indicating whether the message has to be compressed.
     */
    @JsonProperty(value = "compressMessage", required = true)
    private boolean compressMessage;

    /*
     * The value indicating whether to check for duplicate message.
     */
    @JsonProperty(value = "checkDuplicateMessage", required = true)
    private boolean checkDuplicateMessage;

    /*
     * The number of days to look back for duplicate interchange.
     */
    @JsonProperty(value = "interchangeDuplicatesValidityDays", required = true)
    private int interchangeDuplicatesValidityDays;

    /*
     * The value indicating whether to check for certificate revocation list on send.
     */
    @JsonProperty(value = "checkCertificateRevocationListOnSend", required = true)
    private boolean checkCertificateRevocationListOnSend;

    /*
     * The value indicating whether to check for certificate revocation list on receive.
     */
    @JsonProperty(value = "checkCertificateRevocationListOnReceive", required = true)
    private boolean checkCertificateRevocationListOnReceive;

    /*
     * The encryption algorithm.
     */
    @JsonProperty(value = "encryptionAlgorithm", required = true)
    private EncryptionAlgorithm encryptionAlgorithm;

    /*
     * The signing algorithm.
     */
    @JsonProperty(value = "signingAlgorithm")
    private SigningAlgorithm signingAlgorithm;

    /** Creates an instance of AS2ValidationSettings class. */
    public AS2ValidationSettings() {
    }

    /**
     * Get the overrideMessageProperties property: The value indicating whether to override incoming message properties
     * with those in agreement.
     *
     * @return the overrideMessageProperties value.
     */
    public boolean overrideMessageProperties() {
        return this.overrideMessageProperties;
    }

    /**
     * Set the overrideMessageProperties property: The value indicating whether to override incoming message properties
     * with those in agreement.
     *
     * @param overrideMessageProperties the overrideMessageProperties value to set.
     * @return the AS2ValidationSettings object itself.
     */
    public AS2ValidationSettings withOverrideMessageProperties(boolean overrideMessageProperties) {
        this.overrideMessageProperties = overrideMessageProperties;
        return this;
    }

    /**
     * Get the encryptMessage property: The value indicating whether the message has to be encrypted.
     *
     * @return the encryptMessage value.
     */
    public boolean encryptMessage() {
        return this.encryptMessage;
    }

    /**
     * Set the encryptMessage property: The value indicating whether the message has to be encrypted.
     *
     * @param encryptMessage the encryptMessage value to set.
     * @return the AS2ValidationSettings object itself.
     */
    public AS2ValidationSettings withEncryptMessage(boolean encryptMessage) {
        this.encryptMessage = encryptMessage;
        return this;
    }

    /**
     * Get the signMessage property: The value indicating whether the message has to be signed.
     *
     * @return the signMessage value.
     */
    public boolean signMessage() {
        return this.signMessage;
    }

    /**
     * Set the signMessage property: The value indicating whether the message has to be signed.
     *
     * @param signMessage the signMessage value to set.
     * @return the AS2ValidationSettings object itself.
     */
    public AS2ValidationSettings withSignMessage(boolean signMessage) {
        this.signMessage = signMessage;
        return this;
    }

    /**
     * Get the compressMessage property: The value indicating whether the message has to be compressed.
     *
     * @return the compressMessage value.
     */
    public boolean compressMessage() {
        return this.compressMessage;
    }

    /**
     * Set the compressMessage property: The value indicating whether the message has to be compressed.
     *
     * @param compressMessage the compressMessage value to set.
     * @return the AS2ValidationSettings object itself.
     */
    public AS2ValidationSettings withCompressMessage(boolean compressMessage) {
        this.compressMessage = compressMessage;
        return this;
    }

    /**
     * Get the checkDuplicateMessage property: The value indicating whether to check for duplicate message.
     *
     * @return the checkDuplicateMessage value.
     */
    public boolean checkDuplicateMessage() {
        return this.checkDuplicateMessage;
    }

    /**
     * Set the checkDuplicateMessage property: The value indicating whether to check for duplicate message.
     *
     * @param checkDuplicateMessage the checkDuplicateMessage value to set.
     * @return the AS2ValidationSettings object itself.
     */
    public AS2ValidationSettings withCheckDuplicateMessage(boolean checkDuplicateMessage) {
        this.checkDuplicateMessage = checkDuplicateMessage;
        return this;
    }

    /**
     * Get the interchangeDuplicatesValidityDays property: The number of days to look back for duplicate interchange.
     *
     * @return the interchangeDuplicatesValidityDays value.
     */
    public int interchangeDuplicatesValidityDays() {
        return this.interchangeDuplicatesValidityDays;
    }

    /**
     * Set the interchangeDuplicatesValidityDays property: The number of days to look back for duplicate interchange.
     *
     * @param interchangeDuplicatesValidityDays the interchangeDuplicatesValidityDays value to set.
     * @return the AS2ValidationSettings object itself.
     */
    public AS2ValidationSettings withInterchangeDuplicatesValidityDays(int interchangeDuplicatesValidityDays) {
        this.interchangeDuplicatesValidityDays = interchangeDuplicatesValidityDays;
        return this;
    }

    /**
     * Get the checkCertificateRevocationListOnSend property: The value indicating whether to check for certificate
     * revocation list on send.
     *
     * @return the checkCertificateRevocationListOnSend value.
     */
    public boolean checkCertificateRevocationListOnSend() {
        return this.checkCertificateRevocationListOnSend;
    }

    /**
     * Set the checkCertificateRevocationListOnSend property: The value indicating whether to check for certificate
     * revocation list on send.
     *
     * @param checkCertificateRevocationListOnSend the checkCertificateRevocationListOnSend value to set.
     * @return the AS2ValidationSettings object itself.
     */
    public AS2ValidationSettings withCheckCertificateRevocationListOnSend(
        boolean checkCertificateRevocationListOnSend) {
        this.checkCertificateRevocationListOnSend = checkCertificateRevocationListOnSend;
        return this;
    }

    /**
     * Get the checkCertificateRevocationListOnReceive property: The value indicating whether to check for certificate
     * revocation list on receive.
     *
     * @return the checkCertificateRevocationListOnReceive value.
     */
    public boolean checkCertificateRevocationListOnReceive() {
        return this.checkCertificateRevocationListOnReceive;
    }

    /**
     * Set the checkCertificateRevocationListOnReceive property: The value indicating whether to check for certificate
     * revocation list on receive.
     *
     * @param checkCertificateRevocationListOnReceive the checkCertificateRevocationListOnReceive value to set.
     * @return the AS2ValidationSettings object itself.
     */
    public AS2ValidationSettings withCheckCertificateRevocationListOnReceive(
        boolean checkCertificateRevocationListOnReceive) {
        this.checkCertificateRevocationListOnReceive = checkCertificateRevocationListOnReceive;
        return this;
    }

    /**
     * Get the encryptionAlgorithm property: The encryption algorithm.
     *
     * @return the encryptionAlgorithm value.
     */
    public EncryptionAlgorithm encryptionAlgorithm() {
        return this.encryptionAlgorithm;
    }

    /**
     * Set the encryptionAlgorithm property: The encryption algorithm.
     *
     * @param encryptionAlgorithm the encryptionAlgorithm value to set.
     * @return the AS2ValidationSettings object itself.
     */
    public AS2ValidationSettings withEncryptionAlgorithm(EncryptionAlgorithm encryptionAlgorithm) {
        this.encryptionAlgorithm = encryptionAlgorithm;
        return this;
    }

    /**
     * Get the signingAlgorithm property: The signing algorithm.
     *
     * @return the signingAlgorithm value.
     */
    public SigningAlgorithm signingAlgorithm() {
        return this.signingAlgorithm;
    }

    /**
     * Set the signingAlgorithm property: The signing algorithm.
     *
     * @param signingAlgorithm the signingAlgorithm value to set.
     * @return the AS2ValidationSettings object itself.
     */
    public AS2ValidationSettings withSigningAlgorithm(SigningAlgorithm signingAlgorithm) {
        this.signingAlgorithm = signingAlgorithm;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (encryptionAlgorithm() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property encryptionAlgorithm in model AS2ValidationSettings"));
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(AS2ValidationSettings.class);
}
