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

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

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.recoveryservicesbackup.models.OperationStatusError;
import com.azure.resourcemanager.recoveryservicesbackup.models.OperationStatusExtendedInfo;
import com.azure.resourcemanager.recoveryservicesbackup.models.OperationStatusValues;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** Operation status. */
@Fluent
public final class OperationStatusInner {
    /*
     * ID of the operation.
     */
    @JsonProperty(value = "id")
    private String id;

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

    /*
     * Operation status.
     */
    @JsonProperty(value = "status")
    private OperationStatusValues status;

    /*
     * Operation start time. Format: ISO-8601.
     */
    @JsonProperty(value = "startTime")
    private OffsetDateTime startTime;

    /*
     * Operation end time. Format: ISO-8601.
     */
    @JsonProperty(value = "endTime")
    private OffsetDateTime endTime;

    /*
     * Error information related to this operation.
     */
    @JsonProperty(value = "error")
    private OperationStatusError error;

    /*
     * Additional information associated with this operation.
     */
    @JsonProperty(value = "properties")
    private OperationStatusExtendedInfo properties;

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

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

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

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

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

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

    /**
     * Set the status property: Operation status.
     *
     * @param status the status value to set.
     * @return the OperationStatusInner object itself.
     */
    public OperationStatusInner withStatus(OperationStatusValues status) {
        this.status = status;
        return this;
    }

    /**
     * Get the startTime property: Operation start time. Format: ISO-8601.
     *
     * @return the startTime value.
     */
    public OffsetDateTime startTime() {
        return this.startTime;
    }

    /**
     * Set the startTime property: Operation start time. Format: ISO-8601.
     *
     * @param startTime the startTime value to set.
     * @return the OperationStatusInner object itself.
     */
    public OperationStatusInner withStartTime(OffsetDateTime startTime) {
        this.startTime = startTime;
        return this;
    }

    /**
     * Get the endTime property: Operation end time. Format: ISO-8601.
     *
     * @return the endTime value.
     */
    public OffsetDateTime endTime() {
        return this.endTime;
    }

    /**
     * Set the endTime property: Operation end time. Format: ISO-8601.
     *
     * @param endTime the endTime value to set.
     * @return the OperationStatusInner object itself.
     */
    public OperationStatusInner withEndTime(OffsetDateTime endTime) {
        this.endTime = endTime;
        return this;
    }

    /**
     * Get the error property: Error information related to this operation.
     *
     * @return the error value.
     */
    public OperationStatusError error() {
        return this.error;
    }

    /**
     * Set the error property: Error information related to this operation.
     *
     * @param error the error value to set.
     * @return the OperationStatusInner object itself.
     */
    public OperationStatusInner withError(OperationStatusError error) {
        this.error = error;
        return this;
    }

    /**
     * Get the properties property: Additional information associated with this operation.
     *
     * @return the properties value.
     */
    public OperationStatusExtendedInfo properties() {
        return this.properties;
    }

    /**
     * Set the properties property: Additional information associated with this operation.
     *
     * @param properties the properties value to set.
     * @return the OperationStatusInner object itself.
     */
    public OperationStatusInner withProperties(OperationStatusExtendedInfo properties) {
        this.properties = properties;
        return this;
    }

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