// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.dataprotection.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/**
 * InnerError
 *
 * <p>Inner Error.
 */
@Fluent
public final class InnerError {
    /*
     * Any Key value pairs that can be provided to the client for additional  verbose information.
     */
    @JsonProperty(value = "additionalInfo")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, String> additionalInfo;

    /*
     * Unique code for this error
     */
    @JsonProperty(value = "code")
    private String code;

    /*
     * InnerError
     *
     * Child Inner Error, to allow Nesting.
     */
    @JsonProperty(value = "embeddedInnerError")
    private InnerError embeddedInnerError;

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

    /**
     * Get the additionalInfo property: Any Key value pairs that can be provided to the client for additional verbose
     * information.
     *
     * @return the additionalInfo value.
     */
    public Map<String, String> additionalInfo() {
        return this.additionalInfo;
    }

    /**
     * Set the additionalInfo property: Any Key value pairs that can be provided to the client for additional verbose
     * information.
     *
     * @param additionalInfo the additionalInfo value to set.
     * @return the InnerError object itself.
     */
    public InnerError withAdditionalInfo(Map<String, String> additionalInfo) {
        this.additionalInfo = additionalInfo;
        return this;
    }

    /**
     * Get the code property: Unique code for this error.
     *
     * @return the code value.
     */
    public String code() {
        return this.code;
    }

    /**
     * Set the code property: Unique code for this error.
     *
     * @param code the code value to set.
     * @return the InnerError object itself.
     */
    public InnerError withCode(String code) {
        this.code = code;
        return this;
    }

    /**
     * Get the embeddedInnerError property: InnerError
     *
     * <p>Child Inner Error, to allow Nesting.
     *
     * @return the embeddedInnerError value.
     */
    public InnerError embeddedInnerError() {
        return this.embeddedInnerError;
    }

    /**
     * Set the embeddedInnerError property: InnerError
     *
     * <p>Child Inner Error, to allow Nesting.
     *
     * @param embeddedInnerError the embeddedInnerError value to set.
     * @return the InnerError object itself.
     */
    public InnerError withEmbeddedInnerError(InnerError embeddedInnerError) {
        this.embeddedInnerError = embeddedInnerError;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (embeddedInnerError() != null) {
            embeddedInnerError().validate();
        }
    }
}
