// 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 envelope settings. */
@Fluent
public final class AS2EnvelopeSettings {
    /*
     * The message content type.
     */
    @JsonProperty(value = "messageContentType", required = true)
    private String messageContentType;

    /*
     * The value indicating whether to transmit file name in mime header.
     */
    @JsonProperty(value = "transmitFileNameInMimeHeader", required = true)
    private boolean transmitFileNameInMimeHeader;

    /*
     * The template for file name.
     */
    @JsonProperty(value = "fileNameTemplate", required = true)
    private String fileNameTemplate;

    /*
     * The value indicating whether to suspend message on file name generation error.
     */
    @JsonProperty(value = "suspendMessageOnFileNameGenerationError", required = true)
    private boolean suspendMessageOnFileNameGenerationError;

    /*
     * The value indicating whether to auto generate file name.
     */
    @JsonProperty(value = "autogenerateFileName", required = true)
    private boolean autogenerateFileName;

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

    /**
     * Get the messageContentType property: The message content type.
     *
     * @return the messageContentType value.
     */
    public String messageContentType() {
        return this.messageContentType;
    }

    /**
     * Set the messageContentType property: The message content type.
     *
     * @param messageContentType the messageContentType value to set.
     * @return the AS2EnvelopeSettings object itself.
     */
    public AS2EnvelopeSettings withMessageContentType(String messageContentType) {
        this.messageContentType = messageContentType;
        return this;
    }

    /**
     * Get the transmitFileNameInMimeHeader property: The value indicating whether to transmit file name in mime header.
     *
     * @return the transmitFileNameInMimeHeader value.
     */
    public boolean transmitFileNameInMimeHeader() {
        return this.transmitFileNameInMimeHeader;
    }

    /**
     * Set the transmitFileNameInMimeHeader property: The value indicating whether to transmit file name in mime header.
     *
     * @param transmitFileNameInMimeHeader the transmitFileNameInMimeHeader value to set.
     * @return the AS2EnvelopeSettings object itself.
     */
    public AS2EnvelopeSettings withTransmitFileNameInMimeHeader(boolean transmitFileNameInMimeHeader) {
        this.transmitFileNameInMimeHeader = transmitFileNameInMimeHeader;
        return this;
    }

    /**
     * Get the fileNameTemplate property: The template for file name.
     *
     * @return the fileNameTemplate value.
     */
    public String fileNameTemplate() {
        return this.fileNameTemplate;
    }

    /**
     * Set the fileNameTemplate property: The template for file name.
     *
     * @param fileNameTemplate the fileNameTemplate value to set.
     * @return the AS2EnvelopeSettings object itself.
     */
    public AS2EnvelopeSettings withFileNameTemplate(String fileNameTemplate) {
        this.fileNameTemplate = fileNameTemplate;
        return this;
    }

    /**
     * Get the suspendMessageOnFileNameGenerationError property: The value indicating whether to suspend message on file
     * name generation error.
     *
     * @return the suspendMessageOnFileNameGenerationError value.
     */
    public boolean suspendMessageOnFileNameGenerationError() {
        return this.suspendMessageOnFileNameGenerationError;
    }

    /**
     * Set the suspendMessageOnFileNameGenerationError property: The value indicating whether to suspend message on file
     * name generation error.
     *
     * @param suspendMessageOnFileNameGenerationError the suspendMessageOnFileNameGenerationError value to set.
     * @return the AS2EnvelopeSettings object itself.
     */
    public AS2EnvelopeSettings withSuspendMessageOnFileNameGenerationError(
        boolean suspendMessageOnFileNameGenerationError) {
        this.suspendMessageOnFileNameGenerationError = suspendMessageOnFileNameGenerationError;
        return this;
    }

    /**
     * Get the autogenerateFileName property: The value indicating whether to auto generate file name.
     *
     * @return the autogenerateFileName value.
     */
    public boolean autogenerateFileName() {
        return this.autogenerateFileName;
    }

    /**
     * Set the autogenerateFileName property: The value indicating whether to auto generate file name.
     *
     * @param autogenerateFileName the autogenerateFileName value to set.
     * @return the AS2EnvelopeSettings object itself.
     */
    public AS2EnvelopeSettings withAutogenerateFileName(boolean autogenerateFileName) {
        this.autogenerateFileName = autogenerateFileName;
        return this;
    }

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

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