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

package com.azure.resourcemanager.securityinsights;

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.securityinsights.fluent.SecurityInsights;
import com.azure.resourcemanager.securityinsights.implementation.ActionsImpl;
import com.azure.resourcemanager.securityinsights.implementation.AlertRuleTemplatesImpl;
import com.azure.resourcemanager.securityinsights.implementation.AlertRulesImpl;
import com.azure.resourcemanager.securityinsights.implementation.AutomationRulesImpl;
import com.azure.resourcemanager.securityinsights.implementation.BookmarkOperationsImpl;
import com.azure.resourcemanager.securityinsights.implementation.BookmarkRelationsImpl;
import com.azure.resourcemanager.securityinsights.implementation.BookmarksImpl;
import com.azure.resourcemanager.securityinsights.implementation.DataConnectorsCheckRequirementsOperationsImpl;
import com.azure.resourcemanager.securityinsights.implementation.DataConnectorsImpl;
import com.azure.resourcemanager.securityinsights.implementation.DomainWhoisImpl;
import com.azure.resourcemanager.securityinsights.implementation.EntitiesGetTimelinesImpl;
import com.azure.resourcemanager.securityinsights.implementation.EntitiesImpl;
import com.azure.resourcemanager.securityinsights.implementation.EntitiesRelationsImpl;
import com.azure.resourcemanager.securityinsights.implementation.EntityQueriesImpl;
import com.azure.resourcemanager.securityinsights.implementation.EntityQueryTemplatesImpl;
import com.azure.resourcemanager.securityinsights.implementation.EntityRelationsImpl;
import com.azure.resourcemanager.securityinsights.implementation.FileImportsImpl;
import com.azure.resourcemanager.securityinsights.implementation.IncidentCommentsImpl;
import com.azure.resourcemanager.securityinsights.implementation.IncidentRelationsImpl;
import com.azure.resourcemanager.securityinsights.implementation.IncidentsImpl;
import com.azure.resourcemanager.securityinsights.implementation.IpGeodatasImpl;
import com.azure.resourcemanager.securityinsights.implementation.MetadatasImpl;
import com.azure.resourcemanager.securityinsights.implementation.OfficeConsentsImpl;
import com.azure.resourcemanager.securityinsights.implementation.OperationsImpl;
import com.azure.resourcemanager.securityinsights.implementation.ProductSettingsImpl;
import com.azure.resourcemanager.securityinsights.implementation.SecurityInsightsBuilder;
import com.azure.resourcemanager.securityinsights.implementation.SecurityMLAnalyticsSettingsImpl;
import com.azure.resourcemanager.securityinsights.implementation.SentinelOnboardingStatesImpl;
import com.azure.resourcemanager.securityinsights.implementation.SourceControlsImpl;
import com.azure.resourcemanager.securityinsights.implementation.SourceControlsOperationsImpl;
import com.azure.resourcemanager.securityinsights.implementation.ThreatIntelligenceIndicatorMetricsImpl;
import com.azure.resourcemanager.securityinsights.implementation.ThreatIntelligenceIndicatorsImpl;
import com.azure.resourcemanager.securityinsights.implementation.ThreatIntelligenceIndicatorsOperationsImpl;
import com.azure.resourcemanager.securityinsights.implementation.WatchlistItemsImpl;
import com.azure.resourcemanager.securityinsights.implementation.WatchlistsImpl;
import com.azure.resourcemanager.securityinsights.models.Actions;
import com.azure.resourcemanager.securityinsights.models.AlertRuleTemplates;
import com.azure.resourcemanager.securityinsights.models.AlertRules;
import com.azure.resourcemanager.securityinsights.models.AutomationRules;
import com.azure.resourcemanager.securityinsights.models.BookmarkOperations;
import com.azure.resourcemanager.securityinsights.models.BookmarkRelations;
import com.azure.resourcemanager.securityinsights.models.Bookmarks;
import com.azure.resourcemanager.securityinsights.models.DataConnectors;
import com.azure.resourcemanager.securityinsights.models.DataConnectorsCheckRequirementsOperations;
import com.azure.resourcemanager.securityinsights.models.DomainWhois;
import com.azure.resourcemanager.securityinsights.models.Entities;
import com.azure.resourcemanager.securityinsights.models.EntitiesGetTimelines;
import com.azure.resourcemanager.securityinsights.models.EntitiesRelations;
import com.azure.resourcemanager.securityinsights.models.EntityQueries;
import com.azure.resourcemanager.securityinsights.models.EntityQueryTemplates;
import com.azure.resourcemanager.securityinsights.models.EntityRelations;
import com.azure.resourcemanager.securityinsights.models.FileImports;
import com.azure.resourcemanager.securityinsights.models.IncidentComments;
import com.azure.resourcemanager.securityinsights.models.IncidentRelations;
import com.azure.resourcemanager.securityinsights.models.Incidents;
import com.azure.resourcemanager.securityinsights.models.IpGeodatas;
import com.azure.resourcemanager.securityinsights.models.Metadatas;
import com.azure.resourcemanager.securityinsights.models.OfficeConsents;
import com.azure.resourcemanager.securityinsights.models.Operations;
import com.azure.resourcemanager.securityinsights.models.ProductSettings;
import com.azure.resourcemanager.securityinsights.models.SecurityMLAnalyticsSettings;
import com.azure.resourcemanager.securityinsights.models.SentinelOnboardingStates;
import com.azure.resourcemanager.securityinsights.models.SourceControls;
import com.azure.resourcemanager.securityinsights.models.SourceControlsOperations;
import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceIndicatorMetrics;
import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceIndicators;
import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceIndicatorsOperations;
import com.azure.resourcemanager.securityinsights.models.WatchlistItems;
import com.azure.resourcemanager.securityinsights.models.Watchlists;
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 SecurityInsightsManager. API spec for Microsoft.SecurityInsights (Azure Security Insights) resource
 * provider.
 */
public final class SecurityInsightsManager {
    private AlertRules alertRules;

    private Actions actions;

    private AlertRuleTemplates alertRuleTemplates;

    private AutomationRules automationRules;

    private Incidents incidents;

    private Bookmarks bookmarks;

    private BookmarkRelations bookmarkRelations;

    private BookmarkOperations bookmarkOperations;

    private IpGeodatas ipGeodatas;

    private DomainWhois domainWhois;

    private Entities entities;

    private EntitiesGetTimelines entitiesGetTimelines;

    private EntitiesRelations entitiesRelations;

    private EntityRelations entityRelations;

    private EntityQueries entityQueries;

    private EntityQueryTemplates entityQueryTemplates;

    private FileImports fileImports;

    private IncidentComments incidentComments;

    private IncidentRelations incidentRelations;

    private Metadatas metadatas;

    private OfficeConsents officeConsents;

    private SentinelOnboardingStates sentinelOnboardingStates;

    private SecurityMLAnalyticsSettings securityMLAnalyticsSettings;

    private ProductSettings productSettings;

    private SourceControls sourceControls;

    private SourceControlsOperations sourceControlsOperations;

    private ThreatIntelligenceIndicators threatIntelligenceIndicators;

    private ThreatIntelligenceIndicatorsOperations threatIntelligenceIndicatorsOperations;

    private ThreatIntelligenceIndicatorMetrics threatIntelligenceIndicatorMetrics;

    private Watchlists watchlists;

    private WatchlistItems watchlistItems;

    private DataConnectors dataConnectors;

    private DataConnectorsCheckRequirementsOperations dataConnectorsCheckRequirementsOperations;

    private Operations operations;

    private final SecurityInsights clientObject;

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

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

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

    /**
     * Gets the resource collection API of AlertRules.
     *
     * @return Resource collection API of AlertRules.
     */
    public AlertRules alertRules() {
        if (this.alertRules == null) {
            this.alertRules = new AlertRulesImpl(clientObject.getAlertRules(), this);
        }
        return alertRules;
    }

    /**
     * Gets the resource collection API of Actions. It manages ActionResponse.
     *
     * @return Resource collection API of Actions.
     */
    public Actions actions() {
        if (this.actions == null) {
            this.actions = new ActionsImpl(clientObject.getActions(), this);
        }
        return actions;
    }

    /**
     * Gets the resource collection API of AlertRuleTemplates.
     *
     * @return Resource collection API of AlertRuleTemplates.
     */
    public AlertRuleTemplates alertRuleTemplates() {
        if (this.alertRuleTemplates == null) {
            this.alertRuleTemplates = new AlertRuleTemplatesImpl(clientObject.getAlertRuleTemplates(), this);
        }
        return alertRuleTemplates;
    }

    /**
     * Gets the resource collection API of AutomationRules. It manages AutomationRule.
     *
     * @return Resource collection API of AutomationRules.
     */
    public AutomationRules automationRules() {
        if (this.automationRules == null) {
            this.automationRules = new AutomationRulesImpl(clientObject.getAutomationRules(), this);
        }
        return automationRules;
    }

    /**
     * Gets the resource collection API of Incidents. It manages Incident.
     *
     * @return Resource collection API of Incidents.
     */
    public Incidents incidents() {
        if (this.incidents == null) {
            this.incidents = new IncidentsImpl(clientObject.getIncidents(), this);
        }
        return incidents;
    }

    /**
     * Gets the resource collection API of Bookmarks. It manages Bookmark.
     *
     * @return Resource collection API of Bookmarks.
     */
    public Bookmarks bookmarks() {
        if (this.bookmarks == null) {
            this.bookmarks = new BookmarksImpl(clientObject.getBookmarks(), this);
        }
        return bookmarks;
    }

    /**
     * Gets the resource collection API of BookmarkRelations. It manages Relation.
     *
     * @return Resource collection API of BookmarkRelations.
     */
    public BookmarkRelations bookmarkRelations() {
        if (this.bookmarkRelations == null) {
            this.bookmarkRelations = new BookmarkRelationsImpl(clientObject.getBookmarkRelations(), this);
        }
        return bookmarkRelations;
    }

    /**
     * Gets the resource collection API of BookmarkOperations.
     *
     * @return Resource collection API of BookmarkOperations.
     */
    public BookmarkOperations bookmarkOperations() {
        if (this.bookmarkOperations == null) {
            this.bookmarkOperations = new BookmarkOperationsImpl(clientObject.getBookmarkOperations(), this);
        }
        return bookmarkOperations;
    }

    /**
     * Gets the resource collection API of IpGeodatas.
     *
     * @return Resource collection API of IpGeodatas.
     */
    public IpGeodatas ipGeodatas() {
        if (this.ipGeodatas == null) {
            this.ipGeodatas = new IpGeodatasImpl(clientObject.getIpGeodatas(), this);
        }
        return ipGeodatas;
    }

    /**
     * Gets the resource collection API of DomainWhois.
     *
     * @return Resource collection API of DomainWhois.
     */
    public DomainWhois domainWhois() {
        if (this.domainWhois == null) {
            this.domainWhois = new DomainWhoisImpl(clientObject.getDomainWhois(), this);
        }
        return domainWhois;
    }

    /**
     * Gets the resource collection API of Entities.
     *
     * @return Resource collection API of Entities.
     */
    public Entities entities() {
        if (this.entities == null) {
            this.entities = new EntitiesImpl(clientObject.getEntities(), this);
        }
        return entities;
    }

    /**
     * Gets the resource collection API of EntitiesGetTimelines.
     *
     * @return Resource collection API of EntitiesGetTimelines.
     */
    public EntitiesGetTimelines entitiesGetTimelines() {
        if (this.entitiesGetTimelines == null) {
            this.entitiesGetTimelines = new EntitiesGetTimelinesImpl(clientObject.getEntitiesGetTimelines(), this);
        }
        return entitiesGetTimelines;
    }

    /**
     * Gets the resource collection API of EntitiesRelations.
     *
     * @return Resource collection API of EntitiesRelations.
     */
    public EntitiesRelations entitiesRelations() {
        if (this.entitiesRelations == null) {
            this.entitiesRelations = new EntitiesRelationsImpl(clientObject.getEntitiesRelations(), this);
        }
        return entitiesRelations;
    }

    /**
     * Gets the resource collection API of EntityRelations.
     *
     * @return Resource collection API of EntityRelations.
     */
    public EntityRelations entityRelations() {
        if (this.entityRelations == null) {
            this.entityRelations = new EntityRelationsImpl(clientObject.getEntityRelations(), this);
        }
        return entityRelations;
    }

    /**
     * Gets the resource collection API of EntityQueries.
     *
     * @return Resource collection API of EntityQueries.
     */
    public EntityQueries entityQueries() {
        if (this.entityQueries == null) {
            this.entityQueries = new EntityQueriesImpl(clientObject.getEntityQueries(), this);
        }
        return entityQueries;
    }

    /**
     * Gets the resource collection API of EntityQueryTemplates.
     *
     * @return Resource collection API of EntityQueryTemplates.
     */
    public EntityQueryTemplates entityQueryTemplates() {
        if (this.entityQueryTemplates == null) {
            this.entityQueryTemplates = new EntityQueryTemplatesImpl(clientObject.getEntityQueryTemplates(), this);
        }
        return entityQueryTemplates;
    }

    /**
     * Gets the resource collection API of FileImports. It manages FileImport.
     *
     * @return Resource collection API of FileImports.
     */
    public FileImports fileImports() {
        if (this.fileImports == null) {
            this.fileImports = new FileImportsImpl(clientObject.getFileImports(), this);
        }
        return fileImports;
    }

    /**
     * Gets the resource collection API of IncidentComments. It manages IncidentComment.
     *
     * @return Resource collection API of IncidentComments.
     */
    public IncidentComments incidentComments() {
        if (this.incidentComments == null) {
            this.incidentComments = new IncidentCommentsImpl(clientObject.getIncidentComments(), this);
        }
        return incidentComments;
    }

    /**
     * Gets the resource collection API of IncidentRelations.
     *
     * @return Resource collection API of IncidentRelations.
     */
    public IncidentRelations incidentRelations() {
        if (this.incidentRelations == null) {
            this.incidentRelations = new IncidentRelationsImpl(clientObject.getIncidentRelations(), this);
        }
        return incidentRelations;
    }

    /**
     * Gets the resource collection API of Metadatas. It manages MetadataModel.
     *
     * @return Resource collection API of Metadatas.
     */
    public Metadatas metadatas() {
        if (this.metadatas == null) {
            this.metadatas = new MetadatasImpl(clientObject.getMetadatas(), this);
        }
        return metadatas;
    }

    /**
     * Gets the resource collection API of OfficeConsents.
     *
     * @return Resource collection API of OfficeConsents.
     */
    public OfficeConsents officeConsents() {
        if (this.officeConsents == null) {
            this.officeConsents = new OfficeConsentsImpl(clientObject.getOfficeConsents(), this);
        }
        return officeConsents;
    }

    /**
     * Gets the resource collection API of SentinelOnboardingStates. It manages SentinelOnboardingState.
     *
     * @return Resource collection API of SentinelOnboardingStates.
     */
    public SentinelOnboardingStates sentinelOnboardingStates() {
        if (this.sentinelOnboardingStates == null) {
            this.sentinelOnboardingStates =
                new SentinelOnboardingStatesImpl(clientObject.getSentinelOnboardingStates(), this);
        }
        return sentinelOnboardingStates;
    }

    /**
     * Gets the resource collection API of SecurityMLAnalyticsSettings.
     *
     * @return Resource collection API of SecurityMLAnalyticsSettings.
     */
    public SecurityMLAnalyticsSettings securityMLAnalyticsSettings() {
        if (this.securityMLAnalyticsSettings == null) {
            this.securityMLAnalyticsSettings =
                new SecurityMLAnalyticsSettingsImpl(clientObject.getSecurityMLAnalyticsSettings(), this);
        }
        return securityMLAnalyticsSettings;
    }

    /**
     * Gets the resource collection API of ProductSettings.
     *
     * @return Resource collection API of ProductSettings.
     */
    public ProductSettings productSettings() {
        if (this.productSettings == null) {
            this.productSettings = new ProductSettingsImpl(clientObject.getProductSettings(), this);
        }
        return productSettings;
    }

    /**
     * Gets the resource collection API of SourceControls.
     *
     * @return Resource collection API of SourceControls.
     */
    public SourceControls sourceControls() {
        if (this.sourceControls == null) {
            this.sourceControls = new SourceControlsImpl(clientObject.getSourceControls(), this);
        }
        return sourceControls;
    }

    /**
     * Gets the resource collection API of SourceControlsOperations. It manages SourceControl.
     *
     * @return Resource collection API of SourceControlsOperations.
     */
    public SourceControlsOperations sourceControlsOperations() {
        if (this.sourceControlsOperations == null) {
            this.sourceControlsOperations =
                new SourceControlsOperationsImpl(clientObject.getSourceControlsOperations(), this);
        }
        return sourceControlsOperations;
    }

    /**
     * Gets the resource collection API of ThreatIntelligenceIndicators.
     *
     * @return Resource collection API of ThreatIntelligenceIndicators.
     */
    public ThreatIntelligenceIndicators threatIntelligenceIndicators() {
        if (this.threatIntelligenceIndicators == null) {
            this.threatIntelligenceIndicators =
                new ThreatIntelligenceIndicatorsImpl(clientObject.getThreatIntelligenceIndicators(), this);
        }
        return threatIntelligenceIndicators;
    }

    /**
     * Gets the resource collection API of ThreatIntelligenceIndicatorsOperations.
     *
     * @return Resource collection API of ThreatIntelligenceIndicatorsOperations.
     */
    public ThreatIntelligenceIndicatorsOperations threatIntelligenceIndicatorsOperations() {
        if (this.threatIntelligenceIndicatorsOperations == null) {
            this.threatIntelligenceIndicatorsOperations =
                new ThreatIntelligenceIndicatorsOperationsImpl(
                    clientObject.getThreatIntelligenceIndicatorsOperations(), this);
        }
        return threatIntelligenceIndicatorsOperations;
    }

    /**
     * Gets the resource collection API of ThreatIntelligenceIndicatorMetrics.
     *
     * @return Resource collection API of ThreatIntelligenceIndicatorMetrics.
     */
    public ThreatIntelligenceIndicatorMetrics threatIntelligenceIndicatorMetrics() {
        if (this.threatIntelligenceIndicatorMetrics == null) {
            this.threatIntelligenceIndicatorMetrics =
                new ThreatIntelligenceIndicatorMetricsImpl(clientObject.getThreatIntelligenceIndicatorMetrics(), this);
        }
        return threatIntelligenceIndicatorMetrics;
    }

    /**
     * Gets the resource collection API of Watchlists. It manages Watchlist.
     *
     * @return Resource collection API of Watchlists.
     */
    public Watchlists watchlists() {
        if (this.watchlists == null) {
            this.watchlists = new WatchlistsImpl(clientObject.getWatchlists(), this);
        }
        return watchlists;
    }

    /**
     * Gets the resource collection API of WatchlistItems. It manages WatchlistItem.
     *
     * @return Resource collection API of WatchlistItems.
     */
    public WatchlistItems watchlistItems() {
        if (this.watchlistItems == null) {
            this.watchlistItems = new WatchlistItemsImpl(clientObject.getWatchlistItems(), this);
        }
        return watchlistItems;
    }

    /**
     * Gets the resource collection API of DataConnectors.
     *
     * @return Resource collection API of DataConnectors.
     */
    public DataConnectors dataConnectors() {
        if (this.dataConnectors == null) {
            this.dataConnectors = new DataConnectorsImpl(clientObject.getDataConnectors(), this);
        }
        return dataConnectors;
    }

    /**
     * Gets the resource collection API of DataConnectorsCheckRequirementsOperations.
     *
     * @return Resource collection API of DataConnectorsCheckRequirementsOperations.
     */
    public DataConnectorsCheckRequirementsOperations dataConnectorsCheckRequirementsOperations() {
        if (this.dataConnectorsCheckRequirementsOperations == null) {
            this.dataConnectorsCheckRequirementsOperations =
                new DataConnectorsCheckRequirementsOperationsImpl(
                    clientObject.getDataConnectorsCheckRequirementsOperations(), this);
        }
        return dataConnectorsCheckRequirementsOperations;
    }

    /**
     * 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 SecurityInsights providing direct access to the underlying auto-generated API
     *     implementation, based on Azure REST API.
     */
    public SecurityInsights serviceClient() {
        return this.clientObject;
    }
}
