// 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;

import com.azure.core.credential.TokenCredential;
import com.azure.core.http.HttpClient;
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.HttpPipelineBuilder;
import com.azure.core.http.HttpPipelinePosition;
import com.azure.core.http.policy.AddDatePolicy;
import com.azure.core.http.policy.AddHeadersFromContextPolicy;
import com.azure.core.http.policy.HttpLogOptions;
import com.azure.core.http.policy.HttpLoggingPolicy;
import com.azure.core.http.policy.HttpPipelinePolicy;
import com.azure.core.http.policy.HttpPolicyProviders;
import com.azure.core.http.policy.RequestIdPolicy;
import com.azure.core.http.policy.RetryOptions;
import com.azure.core.http.policy.RetryPolicy;
import com.azure.core.http.policy.UserAgentPolicy;
import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy;
import com.azure.core.management.profile.AzureProfile;
import com.azure.core.util.Configuration;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.recoveryservicesbackup.fluent.RecoveryServicesBackupClient;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupEnginesImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupJobsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupOperationResultsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupOperationStatusesImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupPoliciesImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupProtectableItemsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupProtectedItemsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupProtectionContainersImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupProtectionIntentsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupResourceEncryptionConfigsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupResourceStorageConfigsNonCrrsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupResourceVaultConfigsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupStatusImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupUsageSummariesImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupWorkloadItemsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.BmsPrepareDataMoveOperationResultsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.DeletedProtectionContainersImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.ExportJobsOperationResultsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.FeatureSupportsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.ItemLevelRecoveryConnectionsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.JobCancellationsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.JobDetailsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.JobOperationResultsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.JobsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.OperationOperationsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.OperationsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.PrivateEndpointConnectionsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.PrivateEndpointsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectableContainersImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectedItemOperationResultsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectedItemOperationStatusesImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectedItemsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectionContainerOperationResultsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectionContainerRefreshOperationResultsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectionContainersImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectionIntentsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectionPoliciesImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectionPolicyOperationResultsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectionPolicyOperationStatusesImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.RecoveryPointsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.RecoveryPointsRecommendedForMovesImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.RecoveryServicesBackupClientBuilder;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.ResourceGuardProxiesImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.ResourceGuardProxyOperationsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.ResourceProvidersImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.RestoresImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.SecurityPINsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.ValidateOperationResultsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.ValidateOperationStatusesImpl;
import com.azure.resourcemanager.recoveryservicesbackup.implementation.ValidateOperationsImpl;
import com.azure.resourcemanager.recoveryservicesbackup.models.BackupEngines;
import com.azure.resourcemanager.recoveryservicesbackup.models.BackupJobs;
import com.azure.resourcemanager.recoveryservicesbackup.models.BackupOperationResults;
import com.azure.resourcemanager.recoveryservicesbackup.models.BackupOperationStatuses;
import com.azure.resourcemanager.recoveryservicesbackup.models.BackupPolicies;
import com.azure.resourcemanager.recoveryservicesbackup.models.BackupProtectableItems;
import com.azure.resourcemanager.recoveryservicesbackup.models.BackupProtectedItems;
import com.azure.resourcemanager.recoveryservicesbackup.models.BackupProtectionContainers;
import com.azure.resourcemanager.recoveryservicesbackup.models.BackupProtectionIntents;
import com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceEncryptionConfigs;
import com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceStorageConfigsNonCrrs;
import com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceVaultConfigs;
import com.azure.resourcemanager.recoveryservicesbackup.models.BackupStatus;
import com.azure.resourcemanager.recoveryservicesbackup.models.BackupUsageSummaries;
import com.azure.resourcemanager.recoveryservicesbackup.models.BackupWorkloadItems;
import com.azure.resourcemanager.recoveryservicesbackup.models.Backups;
import com.azure.resourcemanager.recoveryservicesbackup.models.BmsPrepareDataMoveOperationResults;
import com.azure.resourcemanager.recoveryservicesbackup.models.DeletedProtectionContainers;
import com.azure.resourcemanager.recoveryservicesbackup.models.ExportJobsOperationResults;
import com.azure.resourcemanager.recoveryservicesbackup.models.FeatureSupports;
import com.azure.resourcemanager.recoveryservicesbackup.models.ItemLevelRecoveryConnections;
import com.azure.resourcemanager.recoveryservicesbackup.models.JobCancellations;
import com.azure.resourcemanager.recoveryservicesbackup.models.JobDetails;
import com.azure.resourcemanager.recoveryservicesbackup.models.JobOperationResults;
import com.azure.resourcemanager.recoveryservicesbackup.models.Jobs;
import com.azure.resourcemanager.recoveryservicesbackup.models.OperationOperations;
import com.azure.resourcemanager.recoveryservicesbackup.models.Operations;
import com.azure.resourcemanager.recoveryservicesbackup.models.PrivateEndpointConnections;
import com.azure.resourcemanager.recoveryservicesbackup.models.PrivateEndpoints;
import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectableContainers;
import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectedItemOperationResults;
import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectedItemOperationStatuses;
import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectedItems;
import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionContainerOperationResults;
import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionContainerRefreshOperationResults;
import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionContainers;
import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionIntents;
import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionPolicies;
import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionPolicyOperationResults;
import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionPolicyOperationStatuses;
import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPoints;
import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointsRecommendedForMoves;
import com.azure.resourcemanager.recoveryservicesbackup.models.ResourceGuardProxies;
import com.azure.resourcemanager.recoveryservicesbackup.models.ResourceGuardProxyOperations;
import com.azure.resourcemanager.recoveryservicesbackup.models.ResourceProviders;
import com.azure.resourcemanager.recoveryservicesbackup.models.Restores;
import com.azure.resourcemanager.recoveryservicesbackup.models.SecurityPINs;
import com.azure.resourcemanager.recoveryservicesbackup.models.ValidateOperationResults;
import com.azure.resourcemanager.recoveryservicesbackup.models.ValidateOperationStatuses;
import com.azure.resourcemanager.recoveryservicesbackup.models.ValidateOperations;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/** Entry point to RecoveryServicesBackupManager. Open API 2.0 Specs for Azure RecoveryServices Backup service. */
public final class RecoveryServicesBackupManager {
    private BackupResourceStorageConfigsNonCrrs backupResourceStorageConfigsNonCrrs;

    private ProtectionIntents protectionIntents;

    private BackupStatus backupStatus;

    private FeatureSupports featureSupports;

    private BackupProtectionIntents backupProtectionIntents;

    private BackupUsageSummaries backupUsageSummaries;

    private Operations operations;

    private BackupResourceVaultConfigs backupResourceVaultConfigs;

    private BackupResourceEncryptionConfigs backupResourceEncryptionConfigs;

    private PrivateEndpointConnections privateEndpointConnections;

    private PrivateEndpoints privateEndpoints;

    private ResourceProviders resourceProviders;

    private BmsPrepareDataMoveOperationResults bmsPrepareDataMoveOperationResults;

    private ProtectedItems protectedItems;

    private ProtectedItemOperationResults protectedItemOperationResults;

    private RecoveryPoints recoveryPoints;

    private Restores restores;

    private BackupPolicies backupPolicies;

    private ProtectionPolicies protectionPolicies;

    private ProtectionPolicyOperationResults protectionPolicyOperationResults;

    private BackupJobs backupJobs;

    private JobDetails jobDetails;

    private JobCancellations jobCancellations;

    private JobOperationResults jobOperationResults;

    private ExportJobsOperationResults exportJobsOperationResults;

    private Jobs jobs;

    private BackupProtectedItems backupProtectedItems;

    private OperationOperations operationOperations;

    private ValidateOperations validateOperations;

    private ValidateOperationResults validateOperationResults;

    private ValidateOperationStatuses validateOperationStatuses;

    private BackupEngines backupEngines;

    private ProtectionContainerRefreshOperationResults protectionContainerRefreshOperationResults;

    private ProtectableContainers protectableContainers;

    private ProtectionContainers protectionContainers;

    private BackupWorkloadItems backupWorkloadItems;

    private ProtectionContainerOperationResults protectionContainerOperationResults;

    private Backups backups;

    private ProtectedItemOperationStatuses protectedItemOperationStatuses;

    private ItemLevelRecoveryConnections itemLevelRecoveryConnections;

    private BackupOperationResults backupOperationResults;

    private BackupOperationStatuses backupOperationStatuses;

    private ProtectionPolicyOperationStatuses protectionPolicyOperationStatuses;

    private BackupProtectableItems backupProtectableItems;

    private BackupProtectionContainers backupProtectionContainers;

    private DeletedProtectionContainers deletedProtectionContainers;

    private SecurityPINs securityPINs;

    private RecoveryPointsRecommendedForMoves recoveryPointsRecommendedForMoves;

    private ResourceGuardProxies resourceGuardProxies;

    private ResourceGuardProxyOperations resourceGuardProxyOperations;

    private final RecoveryServicesBackupClient clientObject;

    private RecoveryServicesBackupManager(
        HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) {
        Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
        Objects.requireNonNull(profile, "'profile' cannot be null.");
        this.clientObject =
            new RecoveryServicesBackupClientBuilder()
                .pipeline(httpPipeline)
                .endpoint(profile.getEnvironment().getResourceManagerEndpoint())
                .subscriptionId(profile.getSubscriptionId())
                .defaultPollInterval(defaultPollInterval)
                .buildClient();
    }

    /**
     * Creates an instance of RecoveryServicesBackup service API entry point.
     *
     * @param credential the credential to use.
     * @param profile the Azure profile for client.
     * @return the RecoveryServicesBackup service API instance.
     */
    public static RecoveryServicesBackupManager authenticate(TokenCredential credential, AzureProfile profile) {
        Objects.requireNonNull(credential, "'credential' cannot be null.");
        Objects.requireNonNull(profile, "'profile' cannot be null.");
        return configure().authenticate(credential, profile);
    }

    /**
     * Creates an instance of RecoveryServicesBackup service API entry point.
     *
     * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential.
     * @param profile the Azure profile for client.
     * @return the RecoveryServicesBackup service API instance.
     */
    public static RecoveryServicesBackupManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
        Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
        Objects.requireNonNull(profile, "'profile' cannot be null.");
        return new RecoveryServicesBackupManager(httpPipeline, profile, null);
    }

    /**
     * Gets a Configurable instance that can be used to create RecoveryServicesBackupManager with optional
     * configuration.
     *
     * @return the Configurable instance allowing configurations.
     */
    public static Configurable configure() {
        return new RecoveryServicesBackupManager.Configurable();
    }

    /** The Configurable allowing configurations to be set. */
    public static final class Configurable {
        private static final ClientLogger LOGGER = new ClientLogger(Configurable.class);

        private HttpClient httpClient;
        private HttpLogOptions httpLogOptions;
        private final List<HttpPipelinePolicy> policies = new ArrayList<>();
        private final List<String> scopes = new ArrayList<>();
        private RetryPolicy retryPolicy;
        private RetryOptions retryOptions;
        private Duration defaultPollInterval;

        private Configurable() {
        }

        /**
         * Sets the http client.
         *
         * @param httpClient the HTTP client.
         * @return the configurable object itself.
         */
        public Configurable withHttpClient(HttpClient httpClient) {
            this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null.");
            return this;
        }

        /**
         * Sets the logging options to the HTTP pipeline.
         *
         * @param httpLogOptions the HTTP log options.
         * @return the configurable object itself.
         */
        public Configurable withLogOptions(HttpLogOptions httpLogOptions) {
            this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null.");
            return this;
        }

        /**
         * Adds the pipeline policy to the HTTP pipeline.
         *
         * @param policy the HTTP pipeline policy.
         * @return the configurable object itself.
         */
        public Configurable withPolicy(HttpPipelinePolicy policy) {
            this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null."));
            return this;
        }

        /**
         * Adds the scope to permission sets.
         *
         * @param scope the scope.
         * @return the configurable object itself.
         */
        public Configurable withScope(String scope) {
            this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null."));
            return this;
        }

        /**
         * Sets the retry policy to the HTTP pipeline.
         *
         * @param retryPolicy the HTTP pipeline retry policy.
         * @return the configurable object itself.
         */
        public Configurable withRetryPolicy(RetryPolicy retryPolicy) {
            this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null.");
            return this;
        }

        /**
         * Sets the retry options for the HTTP pipeline retry policy.
         *
         * <p>This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}.
         *
         * @param retryOptions the retry options for the HTTP pipeline retry policy.
         * @return the configurable object itself.
         */
        public Configurable withRetryOptions(RetryOptions retryOptions) {
            this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null.");
            return this;
        }

        /**
         * Sets the default poll interval, used when service does not provide "Retry-After" header.
         *
         * @param defaultPollInterval the default poll interval.
         * @return the configurable object itself.
         */
        public Configurable withDefaultPollInterval(Duration defaultPollInterval) {
            this.defaultPollInterval =
                Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null.");
            if (this.defaultPollInterval.isNegative()) {
                throw LOGGER
                    .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative"));
            }
            return this;
        }

        /**
         * Creates an instance of RecoveryServicesBackup service API entry point.
         *
         * @param credential the credential to use.
         * @param profile the Azure profile for client.
         * @return the RecoveryServicesBackup service API instance.
         */
        public RecoveryServicesBackupManager authenticate(TokenCredential credential, AzureProfile profile) {
            Objects.requireNonNull(credential, "'credential' cannot be null.");
            Objects.requireNonNull(profile, "'profile' cannot be null.");

            StringBuilder userAgentBuilder = new StringBuilder();
            userAgentBuilder
                .append("azsdk-java")
                .append("-")
                .append("com.azure.resourcemanager.recoveryservicesbackup")
                .append("/")
                .append("1.1.0");
            if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
                userAgentBuilder
                    .append(" (")
                    .append(Configuration.getGlobalConfiguration().get("java.version"))
                    .append("; ")
                    .append(Configuration.getGlobalConfiguration().get("os.name"))
                    .append("; ")
                    .append(Configuration.getGlobalConfiguration().get("os.version"))
                    .append("; auto-generated)");
            } else {
                userAgentBuilder.append(" (auto-generated)");
            }

            if (scopes.isEmpty()) {
                scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default");
            }
            if (retryPolicy == null) {
                if (retryOptions != null) {
                    retryPolicy = new RetryPolicy(retryOptions);
                } else {
                    retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
                }
            }
            List<HttpPipelinePolicy> policies = new ArrayList<>();
            policies.add(new UserAgentPolicy(userAgentBuilder.toString()));
            policies.add(new AddHeadersFromContextPolicy());
            policies.add(new RequestIdPolicy());
            policies
                .addAll(
                    this
                        .policies
                        .stream()
                        .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
                        .collect(Collectors.toList()));
            HttpPolicyProviders.addBeforeRetryPolicies(policies);
            policies.add(retryPolicy);
            policies.add(new AddDatePolicy());
            policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0])));
            policies
                .addAll(
                    this
                        .policies
                        .stream()
                        .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
                        .collect(Collectors.toList()));
            HttpPolicyProviders.addAfterRetryPolicies(policies);
            policies.add(new HttpLoggingPolicy(httpLogOptions));
            HttpPipeline httpPipeline =
                new HttpPipelineBuilder()
                    .httpClient(httpClient)
                    .policies(policies.toArray(new HttpPipelinePolicy[0]))
                    .build();
            return new RecoveryServicesBackupManager(httpPipeline, profile, defaultPollInterval);
        }
    }

    /**
     * Gets the resource collection API of BackupResourceStorageConfigsNonCrrs.
     *
     * @return Resource collection API of BackupResourceStorageConfigsNonCrrs.
     */
    public BackupResourceStorageConfigsNonCrrs backupResourceStorageConfigsNonCrrs() {
        if (this.backupResourceStorageConfigsNonCrrs == null) {
            this.backupResourceStorageConfigsNonCrrs =
                new BackupResourceStorageConfigsNonCrrsImpl(
                    clientObject.getBackupResourceStorageConfigsNonCrrs(), this);
        }
        return backupResourceStorageConfigsNonCrrs;
    }

    /**
     * Gets the resource collection API of ProtectionIntents. It manages ProtectionIntentResource.
     *
     * @return Resource collection API of ProtectionIntents.
     */
    public ProtectionIntents protectionIntents() {
        if (this.protectionIntents == null) {
            this.protectionIntents = new ProtectionIntentsImpl(clientObject.getProtectionIntents(), this);
        }
        return protectionIntents;
    }

    /**
     * Gets the resource collection API of BackupStatus.
     *
     * @return Resource collection API of BackupStatus.
     */
    public BackupStatus backupStatus() {
        if (this.backupStatus == null) {
            this.backupStatus = new BackupStatusImpl(clientObject.getBackupStatus(), this);
        }
        return backupStatus;
    }

    /**
     * Gets the resource collection API of FeatureSupports.
     *
     * @return Resource collection API of FeatureSupports.
     */
    public FeatureSupports featureSupports() {
        if (this.featureSupports == null) {
            this.featureSupports = new FeatureSupportsImpl(clientObject.getFeatureSupports(), this);
        }
        return featureSupports;
    }

    /**
     * Gets the resource collection API of BackupProtectionIntents.
     *
     * @return Resource collection API of BackupProtectionIntents.
     */
    public BackupProtectionIntents backupProtectionIntents() {
        if (this.backupProtectionIntents == null) {
            this.backupProtectionIntents =
                new BackupProtectionIntentsImpl(clientObject.getBackupProtectionIntents(), this);
        }
        return backupProtectionIntents;
    }

    /**
     * Gets the resource collection API of BackupUsageSummaries.
     *
     * @return Resource collection API of BackupUsageSummaries.
     */
    public BackupUsageSummaries backupUsageSummaries() {
        if (this.backupUsageSummaries == null) {
            this.backupUsageSummaries = new BackupUsageSummariesImpl(clientObject.getBackupUsageSummaries(), this);
        }
        return backupUsageSummaries;
    }

    /**
     * Gets the resource collection API of Operations.
     *
     * @return Resource collection API of Operations.
     */
    public Operations operations() {
        if (this.operations == null) {
            this.operations = new OperationsImpl(clientObject.getOperations(), this);
        }
        return operations;
    }

    /**
     * Gets the resource collection API of BackupResourceVaultConfigs.
     *
     * @return Resource collection API of BackupResourceVaultConfigs.
     */
    public BackupResourceVaultConfigs backupResourceVaultConfigs() {
        if (this.backupResourceVaultConfigs == null) {
            this.backupResourceVaultConfigs =
                new BackupResourceVaultConfigsImpl(clientObject.getBackupResourceVaultConfigs(), this);
        }
        return backupResourceVaultConfigs;
    }

    /**
     * Gets the resource collection API of BackupResourceEncryptionConfigs.
     *
     * @return Resource collection API of BackupResourceEncryptionConfigs.
     */
    public BackupResourceEncryptionConfigs backupResourceEncryptionConfigs() {
        if (this.backupResourceEncryptionConfigs == null) {
            this.backupResourceEncryptionConfigs =
                new BackupResourceEncryptionConfigsImpl(clientObject.getBackupResourceEncryptionConfigs(), this);
        }
        return backupResourceEncryptionConfigs;
    }

    /**
     * Gets the resource collection API of PrivateEndpointConnections. It manages PrivateEndpointConnectionResource.
     *
     * @return Resource collection API of PrivateEndpointConnections.
     */
    public PrivateEndpointConnections privateEndpointConnections() {
        if (this.privateEndpointConnections == null) {
            this.privateEndpointConnections =
                new PrivateEndpointConnectionsImpl(clientObject.getPrivateEndpointConnections(), this);
        }
        return privateEndpointConnections;
    }

    /**
     * Gets the resource collection API of PrivateEndpoints.
     *
     * @return Resource collection API of PrivateEndpoints.
     */
    public PrivateEndpoints privateEndpoints() {
        if (this.privateEndpoints == null) {
            this.privateEndpoints = new PrivateEndpointsImpl(clientObject.getPrivateEndpoints(), this);
        }
        return privateEndpoints;
    }

    /**
     * Gets the resource collection API of ResourceProviders.
     *
     * @return Resource collection API of ResourceProviders.
     */
    public ResourceProviders resourceProviders() {
        if (this.resourceProviders == null) {
            this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this);
        }
        return resourceProviders;
    }

    /**
     * Gets the resource collection API of BmsPrepareDataMoveOperationResults.
     *
     * @return Resource collection API of BmsPrepareDataMoveOperationResults.
     */
    public BmsPrepareDataMoveOperationResults bmsPrepareDataMoveOperationResults() {
        if (this.bmsPrepareDataMoveOperationResults == null) {
            this.bmsPrepareDataMoveOperationResults =
                new BmsPrepareDataMoveOperationResultsImpl(clientObject.getBmsPrepareDataMoveOperationResults(), this);
        }
        return bmsPrepareDataMoveOperationResults;
    }

    /**
     * Gets the resource collection API of ProtectedItems. It manages ProtectedItemResource.
     *
     * @return Resource collection API of ProtectedItems.
     */
    public ProtectedItems protectedItems() {
        if (this.protectedItems == null) {
            this.protectedItems = new ProtectedItemsImpl(clientObject.getProtectedItems(), this);
        }
        return protectedItems;
    }

    /**
     * Gets the resource collection API of ProtectedItemOperationResults.
     *
     * @return Resource collection API of ProtectedItemOperationResults.
     */
    public ProtectedItemOperationResults protectedItemOperationResults() {
        if (this.protectedItemOperationResults == null) {
            this.protectedItemOperationResults =
                new ProtectedItemOperationResultsImpl(clientObject.getProtectedItemOperationResults(), this);
        }
        return protectedItemOperationResults;
    }

    /**
     * Gets the resource collection API of RecoveryPoints.
     *
     * @return Resource collection API of RecoveryPoints.
     */
    public RecoveryPoints recoveryPoints() {
        if (this.recoveryPoints == null) {
            this.recoveryPoints = new RecoveryPointsImpl(clientObject.getRecoveryPoints(), this);
        }
        return recoveryPoints;
    }

    /**
     * Gets the resource collection API of Restores.
     *
     * @return Resource collection API of Restores.
     */
    public Restores restores() {
        if (this.restores == null) {
            this.restores = new RestoresImpl(clientObject.getRestores(), this);
        }
        return restores;
    }

    /**
     * Gets the resource collection API of BackupPolicies.
     *
     * @return Resource collection API of BackupPolicies.
     */
    public BackupPolicies backupPolicies() {
        if (this.backupPolicies == null) {
            this.backupPolicies = new BackupPoliciesImpl(clientObject.getBackupPolicies(), this);
        }
        return backupPolicies;
    }

    /**
     * Gets the resource collection API of ProtectionPolicies. It manages ProtectionPolicyResource.
     *
     * @return Resource collection API of ProtectionPolicies.
     */
    public ProtectionPolicies protectionPolicies() {
        if (this.protectionPolicies == null) {
            this.protectionPolicies = new ProtectionPoliciesImpl(clientObject.getProtectionPolicies(), this);
        }
        return protectionPolicies;
    }

    /**
     * Gets the resource collection API of ProtectionPolicyOperationResults.
     *
     * @return Resource collection API of ProtectionPolicyOperationResults.
     */
    public ProtectionPolicyOperationResults protectionPolicyOperationResults() {
        if (this.protectionPolicyOperationResults == null) {
            this.protectionPolicyOperationResults =
                new ProtectionPolicyOperationResultsImpl(clientObject.getProtectionPolicyOperationResults(), this);
        }
        return protectionPolicyOperationResults;
    }

    /**
     * Gets the resource collection API of BackupJobs.
     *
     * @return Resource collection API of BackupJobs.
     */
    public BackupJobs backupJobs() {
        if (this.backupJobs == null) {
            this.backupJobs = new BackupJobsImpl(clientObject.getBackupJobs(), this);
        }
        return backupJobs;
    }

    /**
     * Gets the resource collection API of JobDetails.
     *
     * @return Resource collection API of JobDetails.
     */
    public JobDetails jobDetails() {
        if (this.jobDetails == null) {
            this.jobDetails = new JobDetailsImpl(clientObject.getJobDetails(), this);
        }
        return jobDetails;
    }

    /**
     * Gets the resource collection API of JobCancellations.
     *
     * @return Resource collection API of JobCancellations.
     */
    public JobCancellations jobCancellations() {
        if (this.jobCancellations == null) {
            this.jobCancellations = new JobCancellationsImpl(clientObject.getJobCancellations(), this);
        }
        return jobCancellations;
    }

    /**
     * Gets the resource collection API of JobOperationResults.
     *
     * @return Resource collection API of JobOperationResults.
     */
    public JobOperationResults jobOperationResults() {
        if (this.jobOperationResults == null) {
            this.jobOperationResults = new JobOperationResultsImpl(clientObject.getJobOperationResults(), this);
        }
        return jobOperationResults;
    }

    /**
     * Gets the resource collection API of ExportJobsOperationResults.
     *
     * @return Resource collection API of ExportJobsOperationResults.
     */
    public ExportJobsOperationResults exportJobsOperationResults() {
        if (this.exportJobsOperationResults == null) {
            this.exportJobsOperationResults =
                new ExportJobsOperationResultsImpl(clientObject.getExportJobsOperationResults(), this);
        }
        return exportJobsOperationResults;
    }

    /**
     * Gets the resource collection API of Jobs.
     *
     * @return Resource collection API of Jobs.
     */
    public Jobs jobs() {
        if (this.jobs == null) {
            this.jobs = new JobsImpl(clientObject.getJobs(), this);
        }
        return jobs;
    }

    /**
     * Gets the resource collection API of BackupProtectedItems.
     *
     * @return Resource collection API of BackupProtectedItems.
     */
    public BackupProtectedItems backupProtectedItems() {
        if (this.backupProtectedItems == null) {
            this.backupProtectedItems = new BackupProtectedItemsImpl(clientObject.getBackupProtectedItems(), this);
        }
        return backupProtectedItems;
    }

    /**
     * Gets the resource collection API of OperationOperations.
     *
     * @return Resource collection API of OperationOperations.
     */
    public OperationOperations operationOperations() {
        if (this.operationOperations == null) {
            this.operationOperations = new OperationOperationsImpl(clientObject.getOperationOperations(), this);
        }
        return operationOperations;
    }

    /**
     * Gets the resource collection API of ValidateOperations.
     *
     * @return Resource collection API of ValidateOperations.
     */
    public ValidateOperations validateOperations() {
        if (this.validateOperations == null) {
            this.validateOperations = new ValidateOperationsImpl(clientObject.getValidateOperations(), this);
        }
        return validateOperations;
    }

    /**
     * Gets the resource collection API of ValidateOperationResults.
     *
     * @return Resource collection API of ValidateOperationResults.
     */
    public ValidateOperationResults validateOperationResults() {
        if (this.validateOperationResults == null) {
            this.validateOperationResults =
                new ValidateOperationResultsImpl(clientObject.getValidateOperationResults(), this);
        }
        return validateOperationResults;
    }

    /**
     * Gets the resource collection API of ValidateOperationStatuses.
     *
     * @return Resource collection API of ValidateOperationStatuses.
     */
    public ValidateOperationStatuses validateOperationStatuses() {
        if (this.validateOperationStatuses == null) {
            this.validateOperationStatuses =
                new ValidateOperationStatusesImpl(clientObject.getValidateOperationStatuses(), this);
        }
        return validateOperationStatuses;
    }

    /**
     * Gets the resource collection API of BackupEngines.
     *
     * @return Resource collection API of BackupEngines.
     */
    public BackupEngines backupEngines() {
        if (this.backupEngines == null) {
            this.backupEngines = new BackupEnginesImpl(clientObject.getBackupEngines(), this);
        }
        return backupEngines;
    }

    /**
     * Gets the resource collection API of ProtectionContainerRefreshOperationResults.
     *
     * @return Resource collection API of ProtectionContainerRefreshOperationResults.
     */
    public ProtectionContainerRefreshOperationResults protectionContainerRefreshOperationResults() {
        if (this.protectionContainerRefreshOperationResults == null) {
            this.protectionContainerRefreshOperationResults =
                new ProtectionContainerRefreshOperationResultsImpl(
                    clientObject.getProtectionContainerRefreshOperationResults(), this);
        }
        return protectionContainerRefreshOperationResults;
    }

    /**
     * Gets the resource collection API of ProtectableContainers.
     *
     * @return Resource collection API of ProtectableContainers.
     */
    public ProtectableContainers protectableContainers() {
        if (this.protectableContainers == null) {
            this.protectableContainers = new ProtectableContainersImpl(clientObject.getProtectableContainers(), this);
        }
        return protectableContainers;
    }

    /**
     * Gets the resource collection API of ProtectionContainers. It manages ProtectionContainerResource.
     *
     * @return Resource collection API of ProtectionContainers.
     */
    public ProtectionContainers protectionContainers() {
        if (this.protectionContainers == null) {
            this.protectionContainers = new ProtectionContainersImpl(clientObject.getProtectionContainers(), this);
        }
        return protectionContainers;
    }

    /**
     * Gets the resource collection API of BackupWorkloadItems.
     *
     * @return Resource collection API of BackupWorkloadItems.
     */
    public BackupWorkloadItems backupWorkloadItems() {
        if (this.backupWorkloadItems == null) {
            this.backupWorkloadItems = new BackupWorkloadItemsImpl(clientObject.getBackupWorkloadItems(), this);
        }
        return backupWorkloadItems;
    }

    /**
     * Gets the resource collection API of ProtectionContainerOperationResults.
     *
     * @return Resource collection API of ProtectionContainerOperationResults.
     */
    public ProtectionContainerOperationResults protectionContainerOperationResults() {
        if (this.protectionContainerOperationResults == null) {
            this.protectionContainerOperationResults =
                new ProtectionContainerOperationResultsImpl(
                    clientObject.getProtectionContainerOperationResults(), this);
        }
        return protectionContainerOperationResults;
    }

    /**
     * Gets the resource collection API of Backups.
     *
     * @return Resource collection API of Backups.
     */
    public Backups backups() {
        if (this.backups == null) {
            this.backups = new BackupsImpl(clientObject.getBackups(), this);
        }
        return backups;
    }

    /**
     * Gets the resource collection API of ProtectedItemOperationStatuses.
     *
     * @return Resource collection API of ProtectedItemOperationStatuses.
     */
    public ProtectedItemOperationStatuses protectedItemOperationStatuses() {
        if (this.protectedItemOperationStatuses == null) {
            this.protectedItemOperationStatuses =
                new ProtectedItemOperationStatusesImpl(clientObject.getProtectedItemOperationStatuses(), this);
        }
        return protectedItemOperationStatuses;
    }

    /**
     * Gets the resource collection API of ItemLevelRecoveryConnections.
     *
     * @return Resource collection API of ItemLevelRecoveryConnections.
     */
    public ItemLevelRecoveryConnections itemLevelRecoveryConnections() {
        if (this.itemLevelRecoveryConnections == null) {
            this.itemLevelRecoveryConnections =
                new ItemLevelRecoveryConnectionsImpl(clientObject.getItemLevelRecoveryConnections(), this);
        }
        return itemLevelRecoveryConnections;
    }

    /**
     * Gets the resource collection API of BackupOperationResults.
     *
     * @return Resource collection API of BackupOperationResults.
     */
    public BackupOperationResults backupOperationResults() {
        if (this.backupOperationResults == null) {
            this.backupOperationResults =
                new BackupOperationResultsImpl(clientObject.getBackupOperationResults(), this);
        }
        return backupOperationResults;
    }

    /**
     * Gets the resource collection API of BackupOperationStatuses.
     *
     * @return Resource collection API of BackupOperationStatuses.
     */
    public BackupOperationStatuses backupOperationStatuses() {
        if (this.backupOperationStatuses == null) {
            this.backupOperationStatuses =
                new BackupOperationStatusesImpl(clientObject.getBackupOperationStatuses(), this);
        }
        return backupOperationStatuses;
    }

    /**
     * Gets the resource collection API of ProtectionPolicyOperationStatuses.
     *
     * @return Resource collection API of ProtectionPolicyOperationStatuses.
     */
    public ProtectionPolicyOperationStatuses protectionPolicyOperationStatuses() {
        if (this.protectionPolicyOperationStatuses == null) {
            this.protectionPolicyOperationStatuses =
                new ProtectionPolicyOperationStatusesImpl(clientObject.getProtectionPolicyOperationStatuses(), this);
        }
        return protectionPolicyOperationStatuses;
    }

    /**
     * Gets the resource collection API of BackupProtectableItems.
     *
     * @return Resource collection API of BackupProtectableItems.
     */
    public BackupProtectableItems backupProtectableItems() {
        if (this.backupProtectableItems == null) {
            this.backupProtectableItems =
                new BackupProtectableItemsImpl(clientObject.getBackupProtectableItems(), this);
        }
        return backupProtectableItems;
    }

    /**
     * Gets the resource collection API of BackupProtectionContainers.
     *
     * @return Resource collection API of BackupProtectionContainers.
     */
    public BackupProtectionContainers backupProtectionContainers() {
        if (this.backupProtectionContainers == null) {
            this.backupProtectionContainers =
                new BackupProtectionContainersImpl(clientObject.getBackupProtectionContainers(), this);
        }
        return backupProtectionContainers;
    }

    /**
     * Gets the resource collection API of DeletedProtectionContainers.
     *
     * @return Resource collection API of DeletedProtectionContainers.
     */
    public DeletedProtectionContainers deletedProtectionContainers() {
        if (this.deletedProtectionContainers == null) {
            this.deletedProtectionContainers =
                new DeletedProtectionContainersImpl(clientObject.getDeletedProtectionContainers(), this);
        }
        return deletedProtectionContainers;
    }

    /**
     * Gets the resource collection API of SecurityPINs.
     *
     * @return Resource collection API of SecurityPINs.
     */
    public SecurityPINs securityPINs() {
        if (this.securityPINs == null) {
            this.securityPINs = new SecurityPINsImpl(clientObject.getSecurityPINs(), this);
        }
        return securityPINs;
    }

    /**
     * Gets the resource collection API of RecoveryPointsRecommendedForMoves.
     *
     * @return Resource collection API of RecoveryPointsRecommendedForMoves.
     */
    public RecoveryPointsRecommendedForMoves recoveryPointsRecommendedForMoves() {
        if (this.recoveryPointsRecommendedForMoves == null) {
            this.recoveryPointsRecommendedForMoves =
                new RecoveryPointsRecommendedForMovesImpl(clientObject.getRecoveryPointsRecommendedForMoves(), this);
        }
        return recoveryPointsRecommendedForMoves;
    }

    /**
     * Gets the resource collection API of ResourceGuardProxies.
     *
     * @return Resource collection API of ResourceGuardProxies.
     */
    public ResourceGuardProxies resourceGuardProxies() {
        if (this.resourceGuardProxies == null) {
            this.resourceGuardProxies = new ResourceGuardProxiesImpl(clientObject.getResourceGuardProxies(), this);
        }
        return resourceGuardProxies;
    }

    /**
     * Gets the resource collection API of ResourceGuardProxyOperations. It manages ResourceGuardProxyBaseResource.
     *
     * @return Resource collection API of ResourceGuardProxyOperations.
     */
    public ResourceGuardProxyOperations resourceGuardProxyOperations() {
        if (this.resourceGuardProxyOperations == null) {
            this.resourceGuardProxyOperations =
                new ResourceGuardProxyOperationsImpl(clientObject.getResourceGuardProxyOperations(), this);
        }
        return resourceGuardProxyOperations;
    }

    /**
     * @return Wrapped service client RecoveryServicesBackupClient providing direct access to the underlying
     *     auto-generated API implementation, based on Azure REST API.
     */
    public RecoveryServicesBackupClient serviceClient() {
        return this.clientObject;
    }
}
