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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.core.management.exception.ManagementError;
import com.azure.resourcemanager.mysqlflexibleserver.models.OperationStatus;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** Represents BackupAndExport API Response. */
@Fluent
public final class BackupAndExportResponseInner extends ProxyResource {
    /*
     * The operation status
     */
    @JsonProperty(value = "status")
    private OperationStatus status;

    /*
     * Start time
     */
    @JsonProperty(value = "startTime")
    private OffsetDateTime startTime;

    /*
     * End time
     */
    @JsonProperty(value = "endTime")
    private OffsetDateTime endTime;

    /*
     * Operation progress (0-100).
     */
    @JsonProperty(value = "percentComplete")
    private Double percentComplete;

    /*
     * The response properties of a backup and export operation.
     */
    @JsonProperty(value = "properties")
    private BackupAndExportResponseProperties innerProperties;

    /*
     * Error Response
     *
     * The BackupAndExport operation error response.
     */
    @JsonProperty(value = "error")
    private ManagementError error;

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

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

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

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

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

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

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

    /**
     * Get the percentComplete property: Operation progress (0-100).
     *
     * @return the percentComplete value.
     */
    public Double percentComplete() {
        return this.percentComplete;
    }

    /**
     * Set the percentComplete property: Operation progress (0-100).
     *
     * @param percentComplete the percentComplete value to set.
     * @return the BackupAndExportResponseInner object itself.
     */
    public BackupAndExportResponseInner withPercentComplete(Double percentComplete) {
        this.percentComplete = percentComplete;
        return this;
    }

    /**
     * Get the innerProperties property: The response properties of a backup and export operation.
     *
     * @return the innerProperties value.
     */
    private BackupAndExportResponseProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the error property: Error Response
     *
     * <p>The BackupAndExport operation error response.
     *
     * @return the error value.
     */
    public ManagementError error() {
        return this.error;
    }

    /**
     * Set the error property: Error Response
     *
     * <p>The BackupAndExport operation error response.
     *
     * @param error the error value to set.
     * @return the BackupAndExportResponseInner object itself.
     */
    public BackupAndExportResponseInner withError(ManagementError error) {
        this.error = error;
        return this;
    }

    /**
     * Get the datasourceSizeInBytes property: Size of datasource in bytes.
     *
     * @return the datasourceSizeInBytes value.
     */
    public Long datasourceSizeInBytes() {
        return this.innerProperties() == null ? null : this.innerProperties().datasourceSizeInBytes();
    }

    /**
     * Set the datasourceSizeInBytes property: Size of datasource in bytes.
     *
     * @param datasourceSizeInBytes the datasourceSizeInBytes value to set.
     * @return the BackupAndExportResponseInner object itself.
     */
    public BackupAndExportResponseInner withDatasourceSizeInBytes(Long datasourceSizeInBytes) {
        if (this.innerProperties() == null) {
            this.innerProperties = new BackupAndExportResponseProperties();
        }
        this.innerProperties().withDatasourceSizeInBytes(datasourceSizeInBytes);
        return this;
    }

    /**
     * Get the dataTransferredInBytes property: Data transferred in bytes.
     *
     * @return the dataTransferredInBytes value.
     */
    public Long dataTransferredInBytes() {
        return this.innerProperties() == null ? null : this.innerProperties().dataTransferredInBytes();
    }

    /**
     * Set the dataTransferredInBytes property: Data transferred in bytes.
     *
     * @param dataTransferredInBytes the dataTransferredInBytes value to set.
     * @return the BackupAndExportResponseInner object itself.
     */
    public BackupAndExportResponseInner withDataTransferredInBytes(Long dataTransferredInBytes) {
        if (this.innerProperties() == null) {
            this.innerProperties = new BackupAndExportResponseProperties();
        }
        this.innerProperties().withDataTransferredInBytes(dataTransferredInBytes);
        return this;
    }

    /**
     * Get the backupMetadata property: Metadata related to backup to be stored for restoring resource in key-value
     * pairs.
     *
     * @return the backupMetadata value.
     */
    public String backupMetadata() {
        return this.innerProperties() == null ? null : this.innerProperties().backupMetadata();
    }

    /**
     * Set the backupMetadata property: Metadata related to backup to be stored for restoring resource in key-value
     * pairs.
     *
     * @param backupMetadata the backupMetadata value to set.
     * @return the BackupAndExportResponseInner object itself.
     */
    public BackupAndExportResponseInner withBackupMetadata(String backupMetadata) {
        if (this.innerProperties() == null) {
            this.innerProperties = new BackupAndExportResponseProperties();
        }
        this.innerProperties().withBackupMetadata(backupMetadata);
        return this;
    }

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