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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.postgresqlflexibleserver.models.ExecutionStatus;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** Response for the backup request. */
@Fluent
public final class LtrBackupOperationResponseProperties {
    /*
     * Size of datasource in bytes
     */
    @JsonProperty(value = "datasourceSizeInBytes")
    private Long datasourceSizeInBytes;

    /*
     * Data transferred in bytes
     */
    @JsonProperty(value = "dataTransferredInBytes")
    private Long dataTransferredInBytes;

    /*
     * Name of Backup operation
     */
    @JsonProperty(value = "backupName")
    private String backupName;

    /*
     * Metadata to be stored in RP. Store everything that will be required to perform a successful restore using this
     * Recovery point. e.g. Versions, DataFormat etc
     */
    @JsonProperty(value = "backupMetadata")
    private String backupMetadata;

    /*
     * Service-set extensible enum indicating the status of operation
     */
    @JsonProperty(value = "status", required = true)
    private ExecutionStatus status;

    /*
     * Start time of the operation.
     */
    @JsonProperty(value = "startTime", required = true)
    private OffsetDateTime startTime;

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

    /*
     * PercentageCompleted
     */
    @JsonProperty(value = "percentComplete")
    private Double percentComplete;

    /*
     * The error code.
     */
    @JsonProperty(value = "errorCode", access = JsonProperty.Access.WRITE_ONLY)
    private String errorCode;

    /*
     * The error message.
     */
    @JsonProperty(value = "errorMessage", access = JsonProperty.Access.WRITE_ONLY)
    private String errorMessage;

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

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

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

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

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

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

    /**
     * Set the backupName property: Name of Backup operation.
     *
     * @param backupName the backupName value to set.
     * @return the LtrBackupOperationResponseProperties object itself.
     */
    public LtrBackupOperationResponseProperties withBackupName(String backupName) {
        this.backupName = backupName;
        return this;
    }

    /**
     * Get the backupMetadata property: Metadata to be stored in RP. Store everything that will be required to perform a
     * successful restore using this Recovery point. e.g. Versions, DataFormat etc.
     *
     * @return the backupMetadata value.
     */
    public String backupMetadata() {
        return this.backupMetadata;
    }

    /**
     * Set the backupMetadata property: Metadata to be stored in RP. Store everything that will be required to perform a
     * successful restore using this Recovery point. e.g. Versions, DataFormat etc.
     *
     * @param backupMetadata the backupMetadata value to set.
     * @return the LtrBackupOperationResponseProperties object itself.
     */
    public LtrBackupOperationResponseProperties withBackupMetadata(String backupMetadata) {
        this.backupMetadata = backupMetadata;
        return this;
    }

    /**
     * Get the status property: Service-set extensible enum indicating the status of operation.
     *
     * @return the status value.
     */
    public ExecutionStatus status() {
        return this.status;
    }

    /**
     * Set the status property: Service-set extensible enum indicating the status of operation.
     *
     * @param status the status value to set.
     * @return the LtrBackupOperationResponseProperties object itself.
     */
    public LtrBackupOperationResponseProperties withStatus(ExecutionStatus status) {
        this.status = status;
        return this;
    }

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

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

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

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

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

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

    /**
     * Get the errorCode property: The error code.
     *
     * @return the errorCode value.
     */
    public String errorCode() {
        return this.errorCode;
    }

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

    /**
     * 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 LtrBackupOperationResponseProperties"));
        }
        if (startTime() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property startTime in model LtrBackupOperationResponseProperties"));
        }
    }

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