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

package com.azure.resourcemanager.dataprotection.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;

/**
 * AzureBackupRecoveryPointBasedRestoreRequest
 *
 * <p>Azure backup recoveryPoint based restore request.
 */
@JsonTypeInfo(
    use = JsonTypeInfo.Id.NAME,
    include = JsonTypeInfo.As.PROPERTY,
    property = "objectType",
    defaultImpl = AzureBackupRecoveryPointBasedRestoreRequest.class)
@JsonTypeName("AzureBackupRecoveryPointBasedRestoreRequest")
@JsonSubTypes({
    @JsonSubTypes.Type(
        name = "AzureBackupRestoreWithRehydrationRequest",
        value = AzureBackupRestoreWithRehydrationRequest.class)
})
@Fluent
public class AzureBackupRecoveryPointBasedRestoreRequest extends AzureBackupRestoreRequest {
    /*
     * The recoveryPointId property.
     */
    @JsonProperty(value = "recoveryPointId", required = true)
    private String recoveryPointId;

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

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

    /**
     * Set the recoveryPointId property: The recoveryPointId property.
     *
     * @param recoveryPointId the recoveryPointId value to set.
     * @return the AzureBackupRecoveryPointBasedRestoreRequest object itself.
     */
    public AzureBackupRecoveryPointBasedRestoreRequest withRecoveryPointId(String recoveryPointId) {
        this.recoveryPointId = recoveryPointId;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public AzureBackupRecoveryPointBasedRestoreRequest withRestoreTargetInfo(RestoreTargetInfoBase restoreTargetInfo) {
        super.withRestoreTargetInfo(restoreTargetInfo);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public AzureBackupRecoveryPointBasedRestoreRequest withSourceDataStoreType(
        SourceDataStoreType sourceDataStoreType) {
        super.withSourceDataStoreType(sourceDataStoreType);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public AzureBackupRecoveryPointBasedRestoreRequest withSourceResourceId(String sourceResourceId) {
        super.withSourceResourceId(sourceResourceId);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public AzureBackupRecoveryPointBasedRestoreRequest withIdentityDetails(IdentityDetails identityDetails) {
        super.withIdentityDetails(identityDetails);
        return this;
    }

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

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