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

package com.azure.resourcemanager.devtestlabs.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.devtestlabs.models.HttpStatusCode;
import com.azure.resourcemanager.devtestlabs.models.OperationError;
import com.fasterxml.jackson.annotation.JsonProperty;

/** An Operation Result. */
@Fluent
public final class OperationResultInner {
    /*
     * The operation status.
     */
    @JsonProperty(value = "status")
    private String status;

    /*
     * The status code for the operation.
     */
    @JsonProperty(value = "statusCode")
    private HttpStatusCode statusCode;

    /*
     * Error details for the operation in case of a failure.
     */
    @JsonProperty(value = "error")
    private OperationError error;

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

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

    /**
     * Set the status property: The operation status.
     *
     * @param status the status value to set.
     * @return the OperationResultInner object itself.
     */
    public OperationResultInner withStatus(String status) {
        this.status = status;
        return this;
    }

    /**
     * Get the statusCode property: The status code for the operation.
     *
     * @return the statusCode value.
     */
    public HttpStatusCode statusCode() {
        return this.statusCode;
    }

    /**
     * Set the statusCode property: The status code for the operation.
     *
     * @param statusCode the statusCode value to set.
     * @return the OperationResultInner object itself.
     */
    public OperationResultInner withStatusCode(HttpStatusCode statusCode) {
        this.statusCode = statusCode;
        return this;
    }

    /**
     * Get the error property: Error details for the operation in case of a failure.
     *
     * @return the error value.
     */
    public OperationError error() {
        return this.error;
    }

    /**
     * Set the error property: Error details for the operation in case of a failure.
     *
     * @param error the error value to set.
     * @return the OperationResultInner object itself.
     */
    public OperationResultInner withError(OperationError error) {
        this.error = error;
        return this;
    }

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