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

package com.azure.resourcemanager.reservations.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Required if status == failed or status == canceled. */
@Fluent
public final class OperationResultError {
    /*
     * Required if status == failed or status == cancelled. If status == failed, provide an invariant error code used
     * for error troubleshooting, aggregation, and analysis.
     */
    @JsonProperty(value = "code")
    private String code;

    /*
     * Required if status == failed. Localized. If status == failed, provide an actionable error message indicating
     * what error occurred, and what the user can do to address the issue.
     */
    @JsonProperty(value = "message")
    private String message;

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

    /**
     * Get the code property: Required if status == failed or status == cancelled. If status == failed, provide an
     * invariant error code used for error troubleshooting, aggregation, and analysis.
     *
     * @return the code value.
     */
    public String code() {
        return this.code;
    }

    /**
     * Set the code property: Required if status == failed or status == cancelled. If status == failed, provide an
     * invariant error code used for error troubleshooting, aggregation, and analysis.
     *
     * @param code the code value to set.
     * @return the OperationResultError object itself.
     */
    public OperationResultError withCode(String code) {
        this.code = code;
        return this;
    }

    /**
     * Get the message property: Required if status == failed. Localized. If status == failed, provide an actionable
     * error message indicating what error occurred, and what the user can do to address the issue.
     *
     * @return the message value.
     */
    public String message() {
        return this.message;
    }

    /**
     * Set the message property: Required if status == failed. Localized. If status == failed, provide an actionable
     * error message indicating what error occurred, and what the user can do to address the issue.
     *
     * @param message the message value to set.
     * @return the OperationResultError object itself.
     */
    public OperationResultError withMessage(String message) {
        this.message = message;
        return this;
    }

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