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

package com.azure.resourcemanager.security.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.security.fluent.SqlVulnerabilityAssessmentScansClient;
import com.azure.resourcemanager.security.fluent.models.ScanInner;
import com.azure.resourcemanager.security.fluent.models.ScansInner;
import com.azure.resourcemanager.security.models.Scan;
import com.azure.resourcemanager.security.models.Scans;
import com.azure.resourcemanager.security.models.SqlVulnerabilityAssessmentScans;

public final class SqlVulnerabilityAssessmentScansImpl implements SqlVulnerabilityAssessmentScans {
    private static final ClientLogger LOGGER = new ClientLogger(SqlVulnerabilityAssessmentScansImpl.class);

    private final SqlVulnerabilityAssessmentScansClient innerClient;

    private final com.azure.resourcemanager.security.SecurityManager serviceManager;

    public SqlVulnerabilityAssessmentScansImpl(
        SqlVulnerabilityAssessmentScansClient innerClient,
        com.azure.resourcemanager.security.SecurityManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public Response<Scan> getWithResponse(String scanId, String workspaceId, String resourceId, Context context) {
        Response<ScanInner> inner = this.serviceClient().getWithResponse(scanId, workspaceId, resourceId, context);
        if (inner != null) {
            return new SimpleResponse<>(
                inner.getRequest(),
                inner.getStatusCode(),
                inner.getHeaders(),
                new ScanImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

    public Scan get(String scanId, String workspaceId, String resourceId) {
        ScanInner inner = this.serviceClient().get(scanId, workspaceId, resourceId);
        if (inner != null) {
            return new ScanImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public Response<Scans> listWithResponse(String workspaceId, String resourceId, Context context) {
        Response<ScansInner> inner = this.serviceClient().listWithResponse(workspaceId, resourceId, context);
        if (inner != null) {
            return new SimpleResponse<>(
                inner.getRequest(),
                inner.getStatusCode(),
                inner.getHeaders(),
                new ScansImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

    public Scans list(String workspaceId, String resourceId) {
        ScansInner inner = this.serviceClient().list(workspaceId, resourceId);
        if (inner != null) {
            return new ScansImpl(inner, this.manager());
        } else {
            return null;
        }
    }

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

    private com.azure.resourcemanager.security.SecurityManager manager() {
        return this.serviceManager;
    }
}
