// 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 delimiter override settings. */
@Fluent
public final class X12DelimiterOverrides {
    /*
     * The protocol version.
     */
    @JsonProperty(value = "protocolVersion")
    private String protocolVersion;

    /*
     * The message id.
     */
    @JsonProperty(value = "messageId")
    private String messageId;

    /*
     * The data element separator.
     */
    @JsonProperty(value = "dataElementSeparator", required = true)
    private int dataElementSeparator;

    /*
     * The component separator.
     */
    @JsonProperty(value = "componentSeparator", required = true)
    private int componentSeparator;

    /*
     * The segment terminator.
     */
    @JsonProperty(value = "segmentTerminator", required = true)
    private int segmentTerminator;

    /*
     * The segment terminator suffix.
     */
    @JsonProperty(value = "segmentTerminatorSuffix", required = true)
    private SegmentTerminatorSuffix segmentTerminatorSuffix;

    /*
     * The replacement character.
     */
    @JsonProperty(value = "replaceCharacter", required = true)
    private int replaceCharacter;

    /*
     * The value indicating whether to replace separators in payload.
     */
    @JsonProperty(value = "replaceSeparatorsInPayload", required = true)
    private boolean replaceSeparatorsInPayload;

    /*
     * The target namespace on which this delimiter settings has to be applied.
     */
    @JsonProperty(value = "targetNamespace")
    private String targetNamespace;

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

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

    /**
     * Set the protocolVersion property: The protocol version.
     *
     * @param protocolVersion the protocolVersion value to set.
     * @return the X12DelimiterOverrides object itself.
     */
    public X12DelimiterOverrides withProtocolVersion(String protocolVersion) {
        this.protocolVersion = protocolVersion;
        return this;
    }

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

    /**
     * Set the messageId property: The message id.
     *
     * @param messageId the messageId value to set.
     * @return the X12DelimiterOverrides object itself.
     */
    public X12DelimiterOverrides withMessageId(String messageId) {
        this.messageId = messageId;
        return this;
    }

    /**
     * Get the dataElementSeparator property: The data element separator.
     *
     * @return the dataElementSeparator value.
     */
    public int dataElementSeparator() {
        return this.dataElementSeparator;
    }

    /**
     * Set the dataElementSeparator property: The data element separator.
     *
     * @param dataElementSeparator the dataElementSeparator value to set.
     * @return the X12DelimiterOverrides object itself.
     */
    public X12DelimiterOverrides withDataElementSeparator(int dataElementSeparator) {
        this.dataElementSeparator = dataElementSeparator;
        return this;
    }

    /**
     * Get the componentSeparator property: The component separator.
     *
     * @return the componentSeparator value.
     */
    public int componentSeparator() {
        return this.componentSeparator;
    }

    /**
     * Set the componentSeparator property: The component separator.
     *
     * @param componentSeparator the componentSeparator value to set.
     * @return the X12DelimiterOverrides object itself.
     */
    public X12DelimiterOverrides withComponentSeparator(int componentSeparator) {
        this.componentSeparator = componentSeparator;
        return this;
    }

    /**
     * Get the segmentTerminator property: The segment terminator.
     *
     * @return the segmentTerminator value.
     */
    public int segmentTerminator() {
        return this.segmentTerminator;
    }

    /**
     * Set the segmentTerminator property: The segment terminator.
     *
     * @param segmentTerminator the segmentTerminator value to set.
     * @return the X12DelimiterOverrides object itself.
     */
    public X12DelimiterOverrides withSegmentTerminator(int segmentTerminator) {
        this.segmentTerminator = segmentTerminator;
        return this;
    }

    /**
     * Get the segmentTerminatorSuffix property: The segment terminator suffix.
     *
     * @return the segmentTerminatorSuffix value.
     */
    public SegmentTerminatorSuffix segmentTerminatorSuffix() {
        return this.segmentTerminatorSuffix;
    }

    /**
     * Set the segmentTerminatorSuffix property: The segment terminator suffix.
     *
     * @param segmentTerminatorSuffix the segmentTerminatorSuffix value to set.
     * @return the X12DelimiterOverrides object itself.
     */
    public X12DelimiterOverrides withSegmentTerminatorSuffix(SegmentTerminatorSuffix segmentTerminatorSuffix) {
        this.segmentTerminatorSuffix = segmentTerminatorSuffix;
        return this;
    }

    /**
     * Get the replaceCharacter property: The replacement character.
     *
     * @return the replaceCharacter value.
     */
    public int replaceCharacter() {
        return this.replaceCharacter;
    }

    /**
     * Set the replaceCharacter property: The replacement character.
     *
     * @param replaceCharacter the replaceCharacter value to set.
     * @return the X12DelimiterOverrides object itself.
     */
    public X12DelimiterOverrides withReplaceCharacter(int replaceCharacter) {
        this.replaceCharacter = replaceCharacter;
        return this;
    }

    /**
     * Get the replaceSeparatorsInPayload property: The value indicating whether to replace separators in payload.
     *
     * @return the replaceSeparatorsInPayload value.
     */
    public boolean replaceSeparatorsInPayload() {
        return this.replaceSeparatorsInPayload;
    }

    /**
     * Set the replaceSeparatorsInPayload property: The value indicating whether to replace separators in payload.
     *
     * @param replaceSeparatorsInPayload the replaceSeparatorsInPayload value to set.
     * @return the X12DelimiterOverrides object itself.
     */
    public X12DelimiterOverrides withReplaceSeparatorsInPayload(boolean replaceSeparatorsInPayload) {
        this.replaceSeparatorsInPayload = replaceSeparatorsInPayload;
        return this;
    }

    /**
     * Get the targetNamespace property: The target namespace on which this delimiter 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 delimiter settings has to be applied.
     *
     * @param targetNamespace the targetNamespace value to set.
     * @return the X12DelimiterOverrides object itself.
     */
    public X12DelimiterOverrides withTargetNamespace(String targetNamespace) {
        this.targetNamespace = targetNamespace;
        return this;
    }

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

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