// 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 integration account AS2 agreement content. */
@Fluent
public final class AS2AgreementContent {
    /*
     * The AS2 one-way receive agreement.
     */
    @JsonProperty(value = "receiveAgreement", required = true)
    private AS2OneWayAgreement receiveAgreement;

    /*
     * The AS2 one-way send agreement.
     */
    @JsonProperty(value = "sendAgreement", required = true)
    private AS2OneWayAgreement sendAgreement;

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

    /**
     * Get the receiveAgreement property: The AS2 one-way receive agreement.
     *
     * @return the receiveAgreement value.
     */
    public AS2OneWayAgreement receiveAgreement() {
        return this.receiveAgreement;
    }

    /**
     * Set the receiveAgreement property: The AS2 one-way receive agreement.
     *
     * @param receiveAgreement the receiveAgreement value to set.
     * @return the AS2AgreementContent object itself.
     */
    public AS2AgreementContent withReceiveAgreement(AS2OneWayAgreement receiveAgreement) {
        this.receiveAgreement = receiveAgreement;
        return this;
    }

    /**
     * Get the sendAgreement property: The AS2 one-way send agreement.
     *
     * @return the sendAgreement value.
     */
    public AS2OneWayAgreement sendAgreement() {
        return this.sendAgreement;
    }

    /**
     * Set the sendAgreement property: The AS2 one-way send agreement.
     *
     * @param sendAgreement the sendAgreement value to set.
     * @return the AS2AgreementContent object itself.
     */
    public AS2AgreementContent withSendAgreement(AS2OneWayAgreement sendAgreement) {
        this.sendAgreement = sendAgreement;
        return this;
    }

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

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