// 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 mdn settings. */
@Fluent
public final class AS2MdnSettings {
    /*
     * The value indicating whether to send or request a MDN.
     */
    @JsonProperty(value = "needMDN", required = true)
    private boolean needMdn;

    /*
     * The value indicating whether the MDN needs to be signed or not.
     */
    @JsonProperty(value = "signMDN", required = true)
    private boolean signMdn;

    /*
     * The value indicating whether to send the asynchronous MDN.
     */
    @JsonProperty(value = "sendMDNAsynchronously", required = true)
    private boolean sendMdnAsynchronously;

    /*
     * The receipt delivery URL.
     */
    @JsonProperty(value = "receiptDeliveryUrl")
    private String receiptDeliveryUrl;

    /*
     * The disposition notification to header value.
     */
    @JsonProperty(value = "dispositionNotificationTo")
    private String dispositionNotificationTo;

    /*
     * The value indicating whether to sign the outbound MDN if optional.
     */
    @JsonProperty(value = "signOutboundMDNIfOptional", required = true)
    private boolean signOutboundMdnIfOptional;

    /*
     * The MDN text.
     */
    @JsonProperty(value = "mdnText")
    private String mdnText;

    /*
     * The value indicating whether to send inbound MDN to message box.
     */
    @JsonProperty(value = "sendInboundMDNToMessageBox", required = true)
    private boolean sendInboundMdnToMessageBox;

    /*
     * The signing or hashing algorithm.
     */
    @JsonProperty(value = "micHashingAlgorithm", required = true)
    private HashingAlgorithm micHashingAlgorithm;

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

    /**
     * Get the needMdn property: The value indicating whether to send or request a MDN.
     *
     * @return the needMdn value.
     */
    public boolean needMdn() {
        return this.needMdn;
    }

    /**
     * Set the needMdn property: The value indicating whether to send or request a MDN.
     *
     * @param needMdn the needMdn value to set.
     * @return the AS2MdnSettings object itself.
     */
    public AS2MdnSettings withNeedMdn(boolean needMdn) {
        this.needMdn = needMdn;
        return this;
    }

    /**
     * Get the signMdn property: The value indicating whether the MDN needs to be signed or not.
     *
     * @return the signMdn value.
     */
    public boolean signMdn() {
        return this.signMdn;
    }

    /**
     * Set the signMdn property: The value indicating whether the MDN needs to be signed or not.
     *
     * @param signMdn the signMdn value to set.
     * @return the AS2MdnSettings object itself.
     */
    public AS2MdnSettings withSignMdn(boolean signMdn) {
        this.signMdn = signMdn;
        return this;
    }

    /**
     * Get the sendMdnAsynchronously property: The value indicating whether to send the asynchronous MDN.
     *
     * @return the sendMdnAsynchronously value.
     */
    public boolean sendMdnAsynchronously() {
        return this.sendMdnAsynchronously;
    }

    /**
     * Set the sendMdnAsynchronously property: The value indicating whether to send the asynchronous MDN.
     *
     * @param sendMdnAsynchronously the sendMdnAsynchronously value to set.
     * @return the AS2MdnSettings object itself.
     */
    public AS2MdnSettings withSendMdnAsynchronously(boolean sendMdnAsynchronously) {
        this.sendMdnAsynchronously = sendMdnAsynchronously;
        return this;
    }

    /**
     * Get the receiptDeliveryUrl property: The receipt delivery URL.
     *
     * @return the receiptDeliveryUrl value.
     */
    public String receiptDeliveryUrl() {
        return this.receiptDeliveryUrl;
    }

    /**
     * Set the receiptDeliveryUrl property: The receipt delivery URL.
     *
     * @param receiptDeliveryUrl the receiptDeliveryUrl value to set.
     * @return the AS2MdnSettings object itself.
     */
    public AS2MdnSettings withReceiptDeliveryUrl(String receiptDeliveryUrl) {
        this.receiptDeliveryUrl = receiptDeliveryUrl;
        return this;
    }

    /**
     * Get the dispositionNotificationTo property: The disposition notification to header value.
     *
     * @return the dispositionNotificationTo value.
     */
    public String dispositionNotificationTo() {
        return this.dispositionNotificationTo;
    }

    /**
     * Set the dispositionNotificationTo property: The disposition notification to header value.
     *
     * @param dispositionNotificationTo the dispositionNotificationTo value to set.
     * @return the AS2MdnSettings object itself.
     */
    public AS2MdnSettings withDispositionNotificationTo(String dispositionNotificationTo) {
        this.dispositionNotificationTo = dispositionNotificationTo;
        return this;
    }

    /**
     * Get the signOutboundMdnIfOptional property: The value indicating whether to sign the outbound MDN if optional.
     *
     * @return the signOutboundMdnIfOptional value.
     */
    public boolean signOutboundMdnIfOptional() {
        return this.signOutboundMdnIfOptional;
    }

    /**
     * Set the signOutboundMdnIfOptional property: The value indicating whether to sign the outbound MDN if optional.
     *
     * @param signOutboundMdnIfOptional the signOutboundMdnIfOptional value to set.
     * @return the AS2MdnSettings object itself.
     */
    public AS2MdnSettings withSignOutboundMdnIfOptional(boolean signOutboundMdnIfOptional) {
        this.signOutboundMdnIfOptional = signOutboundMdnIfOptional;
        return this;
    }

    /**
     * Get the mdnText property: The MDN text.
     *
     * @return the mdnText value.
     */
    public String mdnText() {
        return this.mdnText;
    }

    /**
     * Set the mdnText property: The MDN text.
     *
     * @param mdnText the mdnText value to set.
     * @return the AS2MdnSettings object itself.
     */
    public AS2MdnSettings withMdnText(String mdnText) {
        this.mdnText = mdnText;
        return this;
    }

    /**
     * Get the sendInboundMdnToMessageBox property: The value indicating whether to send inbound MDN to message box.
     *
     * @return the sendInboundMdnToMessageBox value.
     */
    public boolean sendInboundMdnToMessageBox() {
        return this.sendInboundMdnToMessageBox;
    }

    /**
     * Set the sendInboundMdnToMessageBox property: The value indicating whether to send inbound MDN to message box.
     *
     * @param sendInboundMdnToMessageBox the sendInboundMdnToMessageBox value to set.
     * @return the AS2MdnSettings object itself.
     */
    public AS2MdnSettings withSendInboundMdnToMessageBox(boolean sendInboundMdnToMessageBox) {
        this.sendInboundMdnToMessageBox = sendInboundMdnToMessageBox;
        return this;
    }

    /**
     * Get the micHashingAlgorithm property: The signing or hashing algorithm.
     *
     * @return the micHashingAlgorithm value.
     */
    public HashingAlgorithm micHashingAlgorithm() {
        return this.micHashingAlgorithm;
    }

    /**
     * Set the micHashingAlgorithm property: The signing or hashing algorithm.
     *
     * @param micHashingAlgorithm the micHashingAlgorithm value to set.
     * @return the AS2MdnSettings object itself.
     */
    public AS2MdnSettings withMicHashingAlgorithm(HashingAlgorithm micHashingAlgorithm) {
        this.micHashingAlgorithm = micHashingAlgorithm;
        return this;
    }

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

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