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

package com.azure.resourcemanager.resourcemover.models;

import com.azure.core.annotation.Immutable;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Class for operation status errors. */
@Immutable
public final class OperationStatusError {
    /*
     * The error code.
     */
    @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY)
    private String code;

    /*
     * The error message.
     */
    @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY)
    private String message;

    /*
     * The error details.
     */
    @JsonProperty(value = "details", access = JsonProperty.Access.WRITE_ONLY)
    private List<OperationStatusError> details;

    /*
     * The additional info.
     */
    @JsonProperty(value = "additionalInfo", access = JsonProperty.Access.WRITE_ONLY)
    private List<OperationErrorAdditionalInfo> additionalInfo;

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

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

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

    /**
     * Get the details property: The error details.
     *
     * @return the details value.
     */
    public List<OperationStatusError> details() {
        return this.details;
    }

    /**
     * Get the additionalInfo property: The additional info.
     *
     * @return the additionalInfo value.
     */
    public List<OperationErrorAdditionalInfo> additionalInfo() {
        return this.additionalInfo;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (details() != null) {
            details().forEach(e -> e.validate());
        }
        if (additionalInfo() != null) {
            additionalInfo().forEach(e -> e.validate());
        }
    }
}
