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

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

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.kusto.models.ProvisioningState;
import com.azure.resourcemanager.kusto.models.Status;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** Operation Result Entity. */
@Fluent
public final class OperationResultInner {
    /*
     * ID of the resource.
     */
    @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY)
    private String id;

    /*
     * Name of the resource.
     */
    @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY)
    private String name;

    /*
     * status of the Operation result.
     */
    @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY)
    private Status status;

    /*
     * The operation start time
     */
    @JsonProperty(value = "startTime")
    private OffsetDateTime startTime;

    /*
     * The operation end time
     */
    @JsonProperty(value = "endTime")
    private OffsetDateTime endTime;

    /*
     * Percentage completed.
     */
    @JsonProperty(value = "percentComplete")
    private Double percentComplete;

    /*
     * Properties of the operation results
     */
    @JsonProperty(value = "properties")
    private OperationResultProperties innerProperties;

    /*
     * Object that contains the error code and message if the operation failed.
     */
    @JsonProperty(value = "error")
    private OperationResultErrorProperties innerError;

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

    /**
     * Get the id property: ID of the resource.
     *
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

    /**
     * Get the name property: Name of the resource.
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Get the status property: status of the Operation result.
     *
     * @return the status value.
     */
    public Status status() {
        return this.status;
    }

    /**
     * Get the startTime property: The operation start time.
     *
     * @return the startTime value.
     */
    public OffsetDateTime startTime() {
        return this.startTime;
    }

    /**
     * Set the startTime property: The operation start time.
     *
     * @param startTime the startTime value to set.
     * @return the OperationResultInner object itself.
     */
    public OperationResultInner withStartTime(OffsetDateTime startTime) {
        this.startTime = startTime;
        return this;
    }

    /**
     * Get the endTime property: The operation end time.
     *
     * @return the endTime value.
     */
    public OffsetDateTime endTime() {
        return this.endTime;
    }

    /**
     * Set the endTime property: The operation end time.
     *
     * @param endTime the endTime value to set.
     * @return the OperationResultInner object itself.
     */
    public OperationResultInner withEndTime(OffsetDateTime endTime) {
        this.endTime = endTime;
        return this;
    }

    /**
     * Get the percentComplete property: Percentage completed.
     *
     * @return the percentComplete value.
     */
    public Double percentComplete() {
        return this.percentComplete;
    }

    /**
     * Set the percentComplete property: Percentage completed.
     *
     * @param percentComplete the percentComplete value to set.
     * @return the OperationResultInner object itself.
     */
    public OperationResultInner withPercentComplete(Double percentComplete) {
        this.percentComplete = percentComplete;
        return this;
    }

    /**
     * Get the innerProperties property: Properties of the operation results.
     *
     * @return the innerProperties value.
     */
    private OperationResultProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the innerError property: Object that contains the error code and message if the operation failed.
     *
     * @return the innerError value.
     */
    private OperationResultErrorProperties innerError() {
        return this.innerError;
    }

    /**
     * Get the operationKind property: The kind of the operation.
     *
     * @return the operationKind value.
     */
    public String operationKind() {
        return this.innerProperties() == null ? null : this.innerProperties().operationKind();
    }

    /**
     * Set the operationKind property: The kind of the operation.
     *
     * @param operationKind the operationKind value to set.
     * @return the OperationResultInner object itself.
     */
    public OperationResultInner withOperationKind(String operationKind) {
        if (this.innerProperties() == null) {
            this.innerProperties = new OperationResultProperties();
        }
        this.innerProperties().withOperationKind(operationKind);
        return this;
    }

    /**
     * Get the provisioningState property: The provisioned state of the resource.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the operationState property: The state of the operation.
     *
     * @return the operationState value.
     */
    public String operationState() {
        return this.innerProperties() == null ? null : this.innerProperties().operationState();
    }

    /**
     * Set the operationState property: The state of the operation.
     *
     * @param operationState the operationState value to set.
     * @return the OperationResultInner object itself.
     */
    public OperationResultInner withOperationState(String operationState) {
        if (this.innerProperties() == null) {
            this.innerProperties = new OperationResultProperties();
        }
        this.innerProperties().withOperationState(operationState);
        return this;
    }

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

    /**
     * Set the code property: The code of the error.
     *
     * @param code the code value to set.
     * @return the OperationResultInner object itself.
     */
    public OperationResultInner withCode(String code) {
        if (this.innerError() == null) {
            this.innerError = new OperationResultErrorProperties();
        }
        this.innerError().withCode(code);
        return this;
    }

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

    /**
     * Set the message property: The error message.
     *
     * @param message the message value to set.
     * @return the OperationResultInner object itself.
     */
    public OperationResultInner withMessage(String message) {
        if (this.innerError() == null) {
            this.innerError = new OperationResultErrorProperties();
        }
        this.innerError().withMessage(message);
        return this;
    }

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