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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.exception.ManagementError;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** The current status of an async operation. */
@Fluent
public final class AsyncOperationStatusInner {
    /*
     * Fully qualified ID for the async operation.
     */
    @JsonProperty(value = "id")
    private String id;

    /*
     * Name of the async operation.
     */
    @JsonProperty(value = "name")
    private String name;

    /*
     * The operation status.
     */
    @JsonProperty(value = "status", required = true)
    private String status;

    /*
     * Fully qualified ID for the resource that this async operation status relates to.
     */
    @JsonProperty(value = "resourceId")
    private String resourceId;

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

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

    /*
     * Percentage of the operation that is complete.
     */
    @JsonProperty(value = "percentComplete")
    private Double percentComplete;

    /*
     * Properties returned by the resource provider on a successful operation
     */
    @JsonProperty(value = "properties")
    private Object properties;

    /*
     * If present, details of the operation error.
     */
    @JsonProperty(value = "error")
    private ManagementError error;

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

    /**
     * Get the id property: Fully qualified ID for the async operation.
     *
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

    /**
     * Set the id property: Fully qualified ID for the async operation.
     *
     * @param id the id value to set.
     * @return the AsyncOperationStatusInner object itself.
     */
    public AsyncOperationStatusInner withId(String id) {
        this.id = id;
        return this;
    }

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

    /**
     * Set the name property: Name of the async operation.
     *
     * @param name the name value to set.
     * @return the AsyncOperationStatusInner object itself.
     */
    public AsyncOperationStatusInner withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * 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 AsyncOperationStatusInner object itself.
     */
    public AsyncOperationStatusInner withStatus(String status) {
        this.status = status;
        return this;
    }

    /**
     * Get the resourceId property: Fully qualified ID for the resource that this async operation status relates to.
     *
     * @return the resourceId value.
     */
    public String resourceId() {
        return this.resourceId;
    }

    /**
     * Set the resourceId property: Fully qualified ID for the resource that this async operation status relates to.
     *
     * @param resourceId the resourceId value to set.
     * @return the AsyncOperationStatusInner object itself.
     */
    public AsyncOperationStatusInner withResourceId(String resourceId) {
        this.resourceId = resourceId;
        return this;
    }

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

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

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

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

    /**
     * Get the percentComplete property: Percentage of the operation that is complete.
     *
     * @return the percentComplete value.
     */
    public Double percentComplete() {
        return this.percentComplete;
    }

    /**
     * Set the percentComplete property: Percentage of the operation that is complete.
     *
     * @param percentComplete the percentComplete value to set.
     * @return the AsyncOperationStatusInner object itself.
     */
    public AsyncOperationStatusInner withPercentComplete(Double percentComplete) {
        this.percentComplete = percentComplete;
        return this;
    }

    /**
     * Get the properties property: Properties returned by the resource provider on a successful operation.
     *
     * @return the properties value.
     */
    public Object properties() {
        return this.properties;
    }

    /**
     * Set the properties property: Properties returned by the resource provider on a successful operation.
     *
     * @param properties the properties value to set.
     * @return the AsyncOperationStatusInner object itself.
     */
    public AsyncOperationStatusInner withProperties(Object properties) {
        this.properties = properties;
        return this;
    }

    /**
     * Get the error property: If present, details of the operation error.
     *
     * @return the error value.
     */
    public ManagementError error() {
        return this.error;
    }

    /**
     * Set the error property: If present, details of the operation error.
     *
     * @param error the error value to set.
     * @return the AsyncOperationStatusInner object itself.
     */
    public AsyncOperationStatusInner withError(ManagementError error) {
        this.error = error;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (status() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property status in model AsyncOperationStatusInner"));
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(AsyncOperationStatusInner.class);
}
