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

import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.SimpleResponse;
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.securityinsights.fluent.ThreatIntelligenceIndicatorMetricsClient;
import com.azure.resourcemanager.securityinsights.fluent.models.ThreatIntelligenceMetricsListInner;
import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceIndicatorMetrics;
import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceMetricsList;

public final class ThreatIntelligenceIndicatorMetricsImpl implements ThreatIntelligenceIndicatorMetrics {
    private static final ClientLogger LOGGER = new ClientLogger(ThreatIntelligenceIndicatorMetricsImpl.class);

    private final ThreatIntelligenceIndicatorMetricsClient innerClient;

    private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager;

    public ThreatIntelligenceIndicatorMetricsImpl(
        ThreatIntelligenceIndicatorMetricsClient innerClient,
        com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public ThreatIntelligenceMetricsList list(String resourceGroupName, String workspaceName) {
        ThreatIntelligenceMetricsListInner inner = this.serviceClient().list(resourceGroupName, workspaceName);
        if (inner != null) {
            return new ThreatIntelligenceMetricsListImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public Response<ThreatIntelligenceMetricsList> listWithResponse(
        String resourceGroupName, String workspaceName, Context context) {
        Response<ThreatIntelligenceMetricsListInner> inner =
            this.serviceClient().listWithResponse(resourceGroupName, workspaceName, context);
        if (inner != null) {
            return new SimpleResponse<>(
                inner.getRequest(),
                inner.getStatusCode(),
                inner.getHeaders(),
                new ThreatIntelligenceMetricsListImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

    private ThreatIntelligenceIndicatorMetricsClient serviceClient() {
        return this.innerClient;
    }

    private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() {
        return this.serviceManager;
    }
}
