// 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 X12 envelope override settings. */
@Fluent
public final class X12EnvelopeOverride {
    /*
     * The target namespace on which this envelope settings has to be applied.
     */
    @JsonProperty(value = "targetNamespace", required = true)
    private String targetNamespace;

    /*
     * The protocol version on which this envelope settings has to be applied.
     */
    @JsonProperty(value = "protocolVersion", required = true)
    private String protocolVersion;

    /*
     * The message id on which this envelope settings has to be applied.
     */
    @JsonProperty(value = "messageId", required = true)
    private String messageId;

    /*
     * The responsible agency code.
     */
    @JsonProperty(value = "responsibleAgencyCode", required = true)
    private String responsibleAgencyCode;

    /*
     * The header version.
     */
    @JsonProperty(value = "headerVersion", required = true)
    private String headerVersion;

    /*
     * The sender application id.
     */
    @JsonProperty(value = "senderApplicationId", required = true)
    private String senderApplicationId;

    /*
     * The receiver application id.
     */
    @JsonProperty(value = "receiverApplicationId", required = true)
    private String receiverApplicationId;

    /*
     * The functional identifier code.
     */
    @JsonProperty(value = "functionalIdentifierCode")
    private String functionalIdentifierCode;

    /*
     * The date format.
     */
    @JsonProperty(value = "dateFormat", required = true)
    private X12DateFormat dateFormat;

    /*
     * The time format.
     */
    @JsonProperty(value = "timeFormat", required = true)
    private X12TimeFormat timeFormat;

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

    /**
     * Get the targetNamespace property: The target namespace on which this envelope settings has to be applied.
     *
     * @return the targetNamespace value.
     */
    public String targetNamespace() {
        return this.targetNamespace;
    }

    /**
     * Set the targetNamespace property: The target namespace on which this envelope settings has to be applied.
     *
     * @param targetNamespace the targetNamespace value to set.
     * @return the X12EnvelopeOverride object itself.
     */
    public X12EnvelopeOverride withTargetNamespace(String targetNamespace) {
        this.targetNamespace = targetNamespace;
        return this;
    }

    /**
     * Get the protocolVersion property: The protocol version on which this envelope settings has to be applied.
     *
     * @return the protocolVersion value.
     */
    public String protocolVersion() {
        return this.protocolVersion;
    }

    /**
     * Set the protocolVersion property: The protocol version on which this envelope settings has to be applied.
     *
     * @param protocolVersion the protocolVersion value to set.
     * @return the X12EnvelopeOverride object itself.
     */
    public X12EnvelopeOverride withProtocolVersion(String protocolVersion) {
        this.protocolVersion = protocolVersion;
        return this;
    }

    /**
     * Get the messageId property: The message id on which this envelope settings has to be applied.
     *
     * @return the messageId value.
     */
    public String messageId() {
        return this.messageId;
    }

    /**
     * Set the messageId property: The message id on which this envelope settings has to be applied.
     *
     * @param messageId the messageId value to set.
     * @return the X12EnvelopeOverride object itself.
     */
    public X12EnvelopeOverride withMessageId(String messageId) {
        this.messageId = messageId;
        return this;
    }

    /**
     * Get the responsibleAgencyCode property: The responsible agency code.
     *
     * @return the responsibleAgencyCode value.
     */
    public String responsibleAgencyCode() {
        return this.responsibleAgencyCode;
    }

    /**
     * Set the responsibleAgencyCode property: The responsible agency code.
     *
     * @param responsibleAgencyCode the responsibleAgencyCode value to set.
     * @return the X12EnvelopeOverride object itself.
     */
    public X12EnvelopeOverride withResponsibleAgencyCode(String responsibleAgencyCode) {
        this.responsibleAgencyCode = responsibleAgencyCode;
        return this;
    }

    /**
     * Get the headerVersion property: The header version.
     *
     * @return the headerVersion value.
     */
    public String headerVersion() {
        return this.headerVersion;
    }

    /**
     * Set the headerVersion property: The header version.
     *
     * @param headerVersion the headerVersion value to set.
     * @return the X12EnvelopeOverride object itself.
     */
    public X12EnvelopeOverride withHeaderVersion(String headerVersion) {
        this.headerVersion = headerVersion;
        return this;
    }

    /**
     * Get the senderApplicationId property: The sender application id.
     *
     * @return the senderApplicationId value.
     */
    public String senderApplicationId() {
        return this.senderApplicationId;
    }

    /**
     * Set the senderApplicationId property: The sender application id.
     *
     * @param senderApplicationId the senderApplicationId value to set.
     * @return the X12EnvelopeOverride object itself.
     */
    public X12EnvelopeOverride withSenderApplicationId(String senderApplicationId) {
        this.senderApplicationId = senderApplicationId;
        return this;
    }

    /**
     * Get the receiverApplicationId property: The receiver application id.
     *
     * @return the receiverApplicationId value.
     */
    public String receiverApplicationId() {
        return this.receiverApplicationId;
    }

    /**
     * Set the receiverApplicationId property: The receiver application id.
     *
     * @param receiverApplicationId the receiverApplicationId value to set.
     * @return the X12EnvelopeOverride object itself.
     */
    public X12EnvelopeOverride withReceiverApplicationId(String receiverApplicationId) {
        this.receiverApplicationId = receiverApplicationId;
        return this;
    }

    /**
     * Get the functionalIdentifierCode property: The functional identifier code.
     *
     * @return the functionalIdentifierCode value.
     */
    public String functionalIdentifierCode() {
        return this.functionalIdentifierCode;
    }

    /**
     * Set the functionalIdentifierCode property: The functional identifier code.
     *
     * @param functionalIdentifierCode the functionalIdentifierCode value to set.
     * @return the X12EnvelopeOverride object itself.
     */
    public X12EnvelopeOverride withFunctionalIdentifierCode(String functionalIdentifierCode) {
        this.functionalIdentifierCode = functionalIdentifierCode;
        return this;
    }

    /**
     * Get the dateFormat property: The date format.
     *
     * @return the dateFormat value.
     */
    public X12DateFormat dateFormat() {
        return this.dateFormat;
    }

    /**
     * Set the dateFormat property: The date format.
     *
     * @param dateFormat the dateFormat value to set.
     * @return the X12EnvelopeOverride object itself.
     */
    public X12EnvelopeOverride withDateFormat(X12DateFormat dateFormat) {
        this.dateFormat = dateFormat;
        return this;
    }

    /**
     * Get the timeFormat property: The time format.
     *
     * @return the timeFormat value.
     */
    public X12TimeFormat timeFormat() {
        return this.timeFormat;
    }

    /**
     * Set the timeFormat property: The time format.
     *
     * @param timeFormat the timeFormat value to set.
     * @return the X12EnvelopeOverride object itself.
     */
    public X12EnvelopeOverride withTimeFormat(X12TimeFormat timeFormat) {
        this.timeFormat = timeFormat;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (targetNamespace() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property targetNamespace in model X12EnvelopeOverride"));
        }
        if (protocolVersion() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property protocolVersion in model X12EnvelopeOverride"));
        }
        if (messageId() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property messageId in model X12EnvelopeOverride"));
        }
        if (responsibleAgencyCode() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property responsibleAgencyCode in model X12EnvelopeOverride"));
        }
        if (headerVersion() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property headerVersion in model X12EnvelopeOverride"));
        }
        if (senderApplicationId() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property senderApplicationId in model X12EnvelopeOverride"));
        }
        if (receiverApplicationId() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property receiverApplicationId in model X12EnvelopeOverride"));
        }
        if (dateFormat() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property dateFormat in model X12EnvelopeOverride"));
        }
        if (timeFormat() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property timeFormat in model X12EnvelopeOverride"));
        }
    }

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