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

package com.azure.resourcemanager.customerinsights.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.customerinsights.fluent.ImagesClient;
import com.azure.resourcemanager.customerinsights.fluent.models.ImageDefinitionInner;
import com.azure.resourcemanager.customerinsights.models.GetImageUploadUrlInput;
import com.azure.resourcemanager.customerinsights.models.ImageDefinition;
import com.azure.resourcemanager.customerinsights.models.Images;

public final class ImagesImpl implements Images {
    private static final ClientLogger LOGGER = new ClientLogger(ImagesImpl.class);

    private final ImagesClient innerClient;

    private final com.azure.resourcemanager.customerinsights.CustomerInsightsManager serviceManager;

    public ImagesImpl(
        ImagesClient innerClient, com.azure.resourcemanager.customerinsights.CustomerInsightsManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public Response<ImageDefinition> getUploadUrlForEntityTypeWithResponse(
        String resourceGroupName, String hubName, GetImageUploadUrlInput parameters, Context context) {
        Response<ImageDefinitionInner> inner =
            this.serviceClient().getUploadUrlForEntityTypeWithResponse(resourceGroupName, hubName, parameters, context);
        if (inner != null) {
            return new SimpleResponse<>(
                inner.getRequest(),
                inner.getStatusCode(),
                inner.getHeaders(),
                new ImageDefinitionImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

    public ImageDefinition getUploadUrlForEntityType(
        String resourceGroupName, String hubName, GetImageUploadUrlInput parameters) {
        ImageDefinitionInner inner =
            this.serviceClient().getUploadUrlForEntityType(resourceGroupName, hubName, parameters);
        if (inner != null) {
            return new ImageDefinitionImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public Response<ImageDefinition> getUploadUrlForDataWithResponse(
        String resourceGroupName, String hubName, GetImageUploadUrlInput parameters, Context context) {
        Response<ImageDefinitionInner> inner =
            this.serviceClient().getUploadUrlForDataWithResponse(resourceGroupName, hubName, parameters, context);
        if (inner != null) {
            return new SimpleResponse<>(
                inner.getRequest(),
                inner.getStatusCode(),
                inner.getHeaders(),
                new ImageDefinitionImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

    public ImageDefinition getUploadUrlForData(
        String resourceGroupName, String hubName, GetImageUploadUrlInput parameters) {
        ImageDefinitionInner inner = this.serviceClient().getUploadUrlForData(resourceGroupName, hubName, parameters);
        if (inner != null) {
            return new ImageDefinitionImpl(inner, this.manager());
        } else {
            return null;
        }
    }

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

    private com.azure.resourcemanager.customerinsights.CustomerInsightsManager manager() {
        return this.serviceManager;
    }
}
