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

package com.azure.resourcemanager.logic;

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.logic.fluent.LogicManagementClient;
import com.azure.resourcemanager.logic.implementation.IntegrationAccountAgreementsImpl;
import com.azure.resourcemanager.logic.implementation.IntegrationAccountAssembliesImpl;
import com.azure.resourcemanager.logic.implementation.IntegrationAccountBatchConfigurationsImpl;
import com.azure.resourcemanager.logic.implementation.IntegrationAccountCertificatesImpl;
import com.azure.resourcemanager.logic.implementation.IntegrationAccountMapsImpl;
import com.azure.resourcemanager.logic.implementation.IntegrationAccountPartnersImpl;
import com.azure.resourcemanager.logic.implementation.IntegrationAccountSchemasImpl;
import com.azure.resourcemanager.logic.implementation.IntegrationAccountSessionsImpl;
import com.azure.resourcemanager.logic.implementation.IntegrationAccountsImpl;
import com.azure.resourcemanager.logic.implementation.IntegrationServiceEnvironmentManagedApiOperationsImpl;
import com.azure.resourcemanager.logic.implementation.IntegrationServiceEnvironmentManagedApisImpl;
import com.azure.resourcemanager.logic.implementation.IntegrationServiceEnvironmentNetworkHealthsImpl;
import com.azure.resourcemanager.logic.implementation.IntegrationServiceEnvironmentSkusImpl;
import com.azure.resourcemanager.logic.implementation.IntegrationServiceEnvironmentsImpl;
import com.azure.resourcemanager.logic.implementation.LogicManagementClientBuilder;
import com.azure.resourcemanager.logic.implementation.OperationsImpl;
import com.azure.resourcemanager.logic.implementation.WorkflowRunActionRepetitionsImpl;
import com.azure.resourcemanager.logic.implementation.WorkflowRunActionRepetitionsRequestHistoriesImpl;
import com.azure.resourcemanager.logic.implementation.WorkflowRunActionRequestHistoriesImpl;
import com.azure.resourcemanager.logic.implementation.WorkflowRunActionScopeRepetitionsImpl;
import com.azure.resourcemanager.logic.implementation.WorkflowRunActionsImpl;
import com.azure.resourcemanager.logic.implementation.WorkflowRunOperationsImpl;
import com.azure.resourcemanager.logic.implementation.WorkflowRunsImpl;
import com.azure.resourcemanager.logic.implementation.WorkflowTriggerHistoriesImpl;
import com.azure.resourcemanager.logic.implementation.WorkflowTriggersImpl;
import com.azure.resourcemanager.logic.implementation.WorkflowVersionTriggersImpl;
import com.azure.resourcemanager.logic.implementation.WorkflowVersionsImpl;
import com.azure.resourcemanager.logic.implementation.WorkflowsImpl;
import com.azure.resourcemanager.logic.models.IntegrationAccountAgreements;
import com.azure.resourcemanager.logic.models.IntegrationAccountAssemblies;
import com.azure.resourcemanager.logic.models.IntegrationAccountBatchConfigurations;
import com.azure.resourcemanager.logic.models.IntegrationAccountCertificates;
import com.azure.resourcemanager.logic.models.IntegrationAccountMaps;
import com.azure.resourcemanager.logic.models.IntegrationAccountPartners;
import com.azure.resourcemanager.logic.models.IntegrationAccountSchemas;
import com.azure.resourcemanager.logic.models.IntegrationAccountSessions;
import com.azure.resourcemanager.logic.models.IntegrationAccounts;
import com.azure.resourcemanager.logic.models.IntegrationServiceEnvironmentManagedApiOperations;
import com.azure.resourcemanager.logic.models.IntegrationServiceEnvironmentManagedApis;
import com.azure.resourcemanager.logic.models.IntegrationServiceEnvironmentNetworkHealths;
import com.azure.resourcemanager.logic.models.IntegrationServiceEnvironmentSkus;
import com.azure.resourcemanager.logic.models.IntegrationServiceEnvironments;
import com.azure.resourcemanager.logic.models.Operations;
import com.azure.resourcemanager.logic.models.WorkflowRunActionRepetitions;
import com.azure.resourcemanager.logic.models.WorkflowRunActionRepetitionsRequestHistories;
import com.azure.resourcemanager.logic.models.WorkflowRunActionRequestHistories;
import com.azure.resourcemanager.logic.models.WorkflowRunActionScopeRepetitions;
import com.azure.resourcemanager.logic.models.WorkflowRunActions;
import com.azure.resourcemanager.logic.models.WorkflowRunOperations;
import com.azure.resourcemanager.logic.models.WorkflowRuns;
import com.azure.resourcemanager.logic.models.WorkflowTriggerHistories;
import com.azure.resourcemanager.logic.models.WorkflowTriggers;
import com.azure.resourcemanager.logic.models.WorkflowVersionTriggers;
import com.azure.resourcemanager.logic.models.WorkflowVersions;
import com.azure.resourcemanager.logic.models.Workflows;
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 LogicManager. REST API for Azure Logic Apps. */
public final class LogicManager {
    private Workflows workflows;

    private WorkflowVersions workflowVersions;

    private WorkflowTriggers workflowTriggers;

    private WorkflowVersionTriggers workflowVersionTriggers;

    private WorkflowTriggerHistories workflowTriggerHistories;

    private WorkflowRuns workflowRuns;

    private WorkflowRunActions workflowRunActions;

    private WorkflowRunActionRepetitions workflowRunActionRepetitions;

    private WorkflowRunActionRepetitionsRequestHistories workflowRunActionRepetitionsRequestHistories;

    private WorkflowRunActionRequestHistories workflowRunActionRequestHistories;

    private WorkflowRunActionScopeRepetitions workflowRunActionScopeRepetitions;

    private WorkflowRunOperations workflowRunOperations;

    private IntegrationAccounts integrationAccounts;

    private IntegrationAccountAssemblies integrationAccountAssemblies;

    private IntegrationAccountBatchConfigurations integrationAccountBatchConfigurations;

    private IntegrationAccountSchemas integrationAccountSchemas;

    private IntegrationAccountMaps integrationAccountMaps;

    private IntegrationAccountPartners integrationAccountPartners;

    private IntegrationAccountAgreements integrationAccountAgreements;

    private IntegrationAccountCertificates integrationAccountCertificates;

    private IntegrationAccountSessions integrationAccountSessions;

    private IntegrationServiceEnvironments integrationServiceEnvironments;

    private IntegrationServiceEnvironmentSkus integrationServiceEnvironmentSkus;

    private IntegrationServiceEnvironmentNetworkHealths integrationServiceEnvironmentNetworkHealths;

    private IntegrationServiceEnvironmentManagedApis integrationServiceEnvironmentManagedApis;

    private IntegrationServiceEnvironmentManagedApiOperations integrationServiceEnvironmentManagedApiOperations;

    private Operations operations;

    private final LogicManagementClient clientObject;

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

    /**
     * Creates an instance of Logic service API entry point.
     *
     * @param credential the credential to use.
     * @param profile the Azure profile for client.
     * @return the Logic service API instance.
     */
    public static LogicManager 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 Logic service API entry point.
     *
     * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential.
     * @param profile the Azure profile for client.
     * @return the Logic service API instance.
     */
    public static LogicManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
        Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
        Objects.requireNonNull(profile, "'profile' cannot be null.");
        return new LogicManager(httpPipeline, profile, null);
    }

    /**
     * Gets a Configurable instance that can be used to create LogicManager with optional configuration.
     *
     * @return the Configurable instance allowing configurations.
     */
    public static Configurable configure() {
        return new LogicManager.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 Logic service API entry point.
         *
         * @param credential the credential to use.
         * @param profile the Azure profile for client.
         * @return the Logic service API instance.
         */
        public LogicManager 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.logic")
                .append("/")
                .append("1.0.0-beta.2");
            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 LogicManager(httpPipeline, profile, defaultPollInterval);
        }
    }

    /**
     * Gets the resource collection API of Workflows. It manages Workflow.
     *
     * @return Resource collection API of Workflows.
     */
    public Workflows workflows() {
        if (this.workflows == null) {
            this.workflows = new WorkflowsImpl(clientObject.getWorkflows(), this);
        }
        return workflows;
    }

    /**
     * Gets the resource collection API of WorkflowVersions.
     *
     * @return Resource collection API of WorkflowVersions.
     */
    public WorkflowVersions workflowVersions() {
        if (this.workflowVersions == null) {
            this.workflowVersions = new WorkflowVersionsImpl(clientObject.getWorkflowVersions(), this);
        }
        return workflowVersions;
    }

    /**
     * Gets the resource collection API of WorkflowTriggers.
     *
     * @return Resource collection API of WorkflowTriggers.
     */
    public WorkflowTriggers workflowTriggers() {
        if (this.workflowTriggers == null) {
            this.workflowTriggers = new WorkflowTriggersImpl(clientObject.getWorkflowTriggers(), this);
        }
        return workflowTriggers;
    }

    /**
     * Gets the resource collection API of WorkflowVersionTriggers.
     *
     * @return Resource collection API of WorkflowVersionTriggers.
     */
    public WorkflowVersionTriggers workflowVersionTriggers() {
        if (this.workflowVersionTriggers == null) {
            this.workflowVersionTriggers =
                new WorkflowVersionTriggersImpl(clientObject.getWorkflowVersionTriggers(), this);
        }
        return workflowVersionTriggers;
    }

    /**
     * Gets the resource collection API of WorkflowTriggerHistories.
     *
     * @return Resource collection API of WorkflowTriggerHistories.
     */
    public WorkflowTriggerHistories workflowTriggerHistories() {
        if (this.workflowTriggerHistories == null) {
            this.workflowTriggerHistories =
                new WorkflowTriggerHistoriesImpl(clientObject.getWorkflowTriggerHistories(), this);
        }
        return workflowTriggerHistories;
    }

    /**
     * Gets the resource collection API of WorkflowRuns.
     *
     * @return Resource collection API of WorkflowRuns.
     */
    public WorkflowRuns workflowRuns() {
        if (this.workflowRuns == null) {
            this.workflowRuns = new WorkflowRunsImpl(clientObject.getWorkflowRuns(), this);
        }
        return workflowRuns;
    }

    /**
     * Gets the resource collection API of WorkflowRunActions.
     *
     * @return Resource collection API of WorkflowRunActions.
     */
    public WorkflowRunActions workflowRunActions() {
        if (this.workflowRunActions == null) {
            this.workflowRunActions = new WorkflowRunActionsImpl(clientObject.getWorkflowRunActions(), this);
        }
        return workflowRunActions;
    }

    /**
     * Gets the resource collection API of WorkflowRunActionRepetitions.
     *
     * @return Resource collection API of WorkflowRunActionRepetitions.
     */
    public WorkflowRunActionRepetitions workflowRunActionRepetitions() {
        if (this.workflowRunActionRepetitions == null) {
            this.workflowRunActionRepetitions =
                new WorkflowRunActionRepetitionsImpl(clientObject.getWorkflowRunActionRepetitions(), this);
        }
        return workflowRunActionRepetitions;
    }

    /**
     * Gets the resource collection API of WorkflowRunActionRepetitionsRequestHistories.
     *
     * @return Resource collection API of WorkflowRunActionRepetitionsRequestHistories.
     */
    public WorkflowRunActionRepetitionsRequestHistories workflowRunActionRepetitionsRequestHistories() {
        if (this.workflowRunActionRepetitionsRequestHistories == null) {
            this.workflowRunActionRepetitionsRequestHistories =
                new WorkflowRunActionRepetitionsRequestHistoriesImpl(
                    clientObject.getWorkflowRunActionRepetitionsRequestHistories(), this);
        }
        return workflowRunActionRepetitionsRequestHistories;
    }

    /**
     * Gets the resource collection API of WorkflowRunActionRequestHistories.
     *
     * @return Resource collection API of WorkflowRunActionRequestHistories.
     */
    public WorkflowRunActionRequestHistories workflowRunActionRequestHistories() {
        if (this.workflowRunActionRequestHistories == null) {
            this.workflowRunActionRequestHistories =
                new WorkflowRunActionRequestHistoriesImpl(clientObject.getWorkflowRunActionRequestHistories(), this);
        }
        return workflowRunActionRequestHistories;
    }

    /**
     * Gets the resource collection API of WorkflowRunActionScopeRepetitions.
     *
     * @return Resource collection API of WorkflowRunActionScopeRepetitions.
     */
    public WorkflowRunActionScopeRepetitions workflowRunActionScopeRepetitions() {
        if (this.workflowRunActionScopeRepetitions == null) {
            this.workflowRunActionScopeRepetitions =
                new WorkflowRunActionScopeRepetitionsImpl(clientObject.getWorkflowRunActionScopeRepetitions(), this);
        }
        return workflowRunActionScopeRepetitions;
    }

    /**
     * Gets the resource collection API of WorkflowRunOperations.
     *
     * @return Resource collection API of WorkflowRunOperations.
     */
    public WorkflowRunOperations workflowRunOperations() {
        if (this.workflowRunOperations == null) {
            this.workflowRunOperations = new WorkflowRunOperationsImpl(clientObject.getWorkflowRunOperations(), this);
        }
        return workflowRunOperations;
    }

    /**
     * Gets the resource collection API of IntegrationAccounts. It manages IntegrationAccount.
     *
     * @return Resource collection API of IntegrationAccounts.
     */
    public IntegrationAccounts integrationAccounts() {
        if (this.integrationAccounts == null) {
            this.integrationAccounts = new IntegrationAccountsImpl(clientObject.getIntegrationAccounts(), this);
        }
        return integrationAccounts;
    }

    /**
     * Gets the resource collection API of IntegrationAccountAssemblies. It manages AssemblyDefinition.
     *
     * @return Resource collection API of IntegrationAccountAssemblies.
     */
    public IntegrationAccountAssemblies integrationAccountAssemblies() {
        if (this.integrationAccountAssemblies == null) {
            this.integrationAccountAssemblies =
                new IntegrationAccountAssembliesImpl(clientObject.getIntegrationAccountAssemblies(), this);
        }
        return integrationAccountAssemblies;
    }

    /**
     * Gets the resource collection API of IntegrationAccountBatchConfigurations. It manages BatchConfiguration.
     *
     * @return Resource collection API of IntegrationAccountBatchConfigurations.
     */
    public IntegrationAccountBatchConfigurations integrationAccountBatchConfigurations() {
        if (this.integrationAccountBatchConfigurations == null) {
            this.integrationAccountBatchConfigurations =
                new IntegrationAccountBatchConfigurationsImpl(
                    clientObject.getIntegrationAccountBatchConfigurations(), this);
        }
        return integrationAccountBatchConfigurations;
    }

    /**
     * Gets the resource collection API of IntegrationAccountSchemas. It manages IntegrationAccountSchema.
     *
     * @return Resource collection API of IntegrationAccountSchemas.
     */
    public IntegrationAccountSchemas integrationAccountSchemas() {
        if (this.integrationAccountSchemas == null) {
            this.integrationAccountSchemas =
                new IntegrationAccountSchemasImpl(clientObject.getIntegrationAccountSchemas(), this);
        }
        return integrationAccountSchemas;
    }

    /**
     * Gets the resource collection API of IntegrationAccountMaps. It manages IntegrationAccountMap.
     *
     * @return Resource collection API of IntegrationAccountMaps.
     */
    public IntegrationAccountMaps integrationAccountMaps() {
        if (this.integrationAccountMaps == null) {
            this.integrationAccountMaps =
                new IntegrationAccountMapsImpl(clientObject.getIntegrationAccountMaps(), this);
        }
        return integrationAccountMaps;
    }

    /**
     * Gets the resource collection API of IntegrationAccountPartners. It manages IntegrationAccountPartner.
     *
     * @return Resource collection API of IntegrationAccountPartners.
     */
    public IntegrationAccountPartners integrationAccountPartners() {
        if (this.integrationAccountPartners == null) {
            this.integrationAccountPartners =
                new IntegrationAccountPartnersImpl(clientObject.getIntegrationAccountPartners(), this);
        }
        return integrationAccountPartners;
    }

    /**
     * Gets the resource collection API of IntegrationAccountAgreements. It manages IntegrationAccountAgreement.
     *
     * @return Resource collection API of IntegrationAccountAgreements.
     */
    public IntegrationAccountAgreements integrationAccountAgreements() {
        if (this.integrationAccountAgreements == null) {
            this.integrationAccountAgreements =
                new IntegrationAccountAgreementsImpl(clientObject.getIntegrationAccountAgreements(), this);
        }
        return integrationAccountAgreements;
    }

    /**
     * Gets the resource collection API of IntegrationAccountCertificates. It manages IntegrationAccountCertificate.
     *
     * @return Resource collection API of IntegrationAccountCertificates.
     */
    public IntegrationAccountCertificates integrationAccountCertificates() {
        if (this.integrationAccountCertificates == null) {
            this.integrationAccountCertificates =
                new IntegrationAccountCertificatesImpl(clientObject.getIntegrationAccountCertificates(), this);
        }
        return integrationAccountCertificates;
    }

    /**
     * Gets the resource collection API of IntegrationAccountSessions. It manages IntegrationAccountSession.
     *
     * @return Resource collection API of IntegrationAccountSessions.
     */
    public IntegrationAccountSessions integrationAccountSessions() {
        if (this.integrationAccountSessions == null) {
            this.integrationAccountSessions =
                new IntegrationAccountSessionsImpl(clientObject.getIntegrationAccountSessions(), this);
        }
        return integrationAccountSessions;
    }

    /**
     * Gets the resource collection API of IntegrationServiceEnvironments. It manages IntegrationServiceEnvironment.
     *
     * @return Resource collection API of IntegrationServiceEnvironments.
     */
    public IntegrationServiceEnvironments integrationServiceEnvironments() {
        if (this.integrationServiceEnvironments == null) {
            this.integrationServiceEnvironments =
                new IntegrationServiceEnvironmentsImpl(clientObject.getIntegrationServiceEnvironments(), this);
        }
        return integrationServiceEnvironments;
    }

    /**
     * Gets the resource collection API of IntegrationServiceEnvironmentSkus.
     *
     * @return Resource collection API of IntegrationServiceEnvironmentSkus.
     */
    public IntegrationServiceEnvironmentSkus integrationServiceEnvironmentSkus() {
        if (this.integrationServiceEnvironmentSkus == null) {
            this.integrationServiceEnvironmentSkus =
                new IntegrationServiceEnvironmentSkusImpl(clientObject.getIntegrationServiceEnvironmentSkus(), this);
        }
        return integrationServiceEnvironmentSkus;
    }

    /**
     * Gets the resource collection API of IntegrationServiceEnvironmentNetworkHealths.
     *
     * @return Resource collection API of IntegrationServiceEnvironmentNetworkHealths.
     */
    public IntegrationServiceEnvironmentNetworkHealths integrationServiceEnvironmentNetworkHealths() {
        if (this.integrationServiceEnvironmentNetworkHealths == null) {
            this.integrationServiceEnvironmentNetworkHealths =
                new IntegrationServiceEnvironmentNetworkHealthsImpl(
                    clientObject.getIntegrationServiceEnvironmentNetworkHealths(), this);
        }
        return integrationServiceEnvironmentNetworkHealths;
    }

    /**
     * Gets the resource collection API of IntegrationServiceEnvironmentManagedApis. It manages
     * IntegrationServiceEnvironmentManagedApi.
     *
     * @return Resource collection API of IntegrationServiceEnvironmentManagedApis.
     */
    public IntegrationServiceEnvironmentManagedApis integrationServiceEnvironmentManagedApis() {
        if (this.integrationServiceEnvironmentManagedApis == null) {
            this.integrationServiceEnvironmentManagedApis =
                new IntegrationServiceEnvironmentManagedApisImpl(
                    clientObject.getIntegrationServiceEnvironmentManagedApis(), this);
        }
        return integrationServiceEnvironmentManagedApis;
    }

    /**
     * Gets the resource collection API of IntegrationServiceEnvironmentManagedApiOperations.
     *
     * @return Resource collection API of IntegrationServiceEnvironmentManagedApiOperations.
     */
    public IntegrationServiceEnvironmentManagedApiOperations integrationServiceEnvironmentManagedApiOperations() {
        if (this.integrationServiceEnvironmentManagedApiOperations == null) {
            this.integrationServiceEnvironmentManagedApiOperations =
                new IntegrationServiceEnvironmentManagedApiOperationsImpl(
                    clientObject.getIntegrationServiceEnvironmentManagedApiOperations(), this);
        }
        return integrationServiceEnvironmentManagedApiOperations;
    }

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

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