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

package com.azure.analytics.synapse.artifacts;

import com.azure.analytics.synapse.artifacts.implementation.MetastoresImpl;
import com.azure.analytics.synapse.artifacts.models.ErrorContractException;
import com.azure.analytics.synapse.artifacts.models.MetastoreRegisterObject;
import com.azure.analytics.synapse.artifacts.models.MetastoreRegistrationResponse;
import com.azure.analytics.synapse.artifacts.models.MetastoreRequestSuccessResponse;
import com.azure.analytics.synapse.artifacts.models.MetastoreUpdateObject;
import com.azure.analytics.synapse.artifacts.models.MetastoreUpdationResponse;
import com.azure.core.annotation.Generated;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.http.rest.Response;
import reactor.core.publisher.Mono;

/** Initializes a new instance of the asynchronous ArtifactsClient type. */
@ServiceClient(builder = ArtifactsClientBuilder.class, isAsync = true)
public final class MetastoreAsyncClient {
    @Generated private final MetastoresImpl serviceClient;

    /**
     * Initializes an instance of MetastoreAsyncClient class.
     *
     * @param serviceClient the service client implementation.
     */
    @Generated
    MetastoreAsyncClient(MetastoresImpl serviceClient) {
        this.serviceClient = serviceClient;
    }

    /**
     * Register files in Syms.
     *
     * @param id The name of the database to be created. The name can contain only alphanumeric characters and should
     *     not exceed 24 characters.
     * @param registerBody The body for the register request.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ErrorContractException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body along with {@link Response} on successful completion of {@link Mono}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<MetastoreRegistrationResponse>> registerWithResponse(
            String id, MetastoreRegisterObject registerBody) {
        return this.serviceClient.registerWithResponseAsync(id, registerBody);
    }

    /**
     * Register files in Syms.
     *
     * @param id The name of the database to be created. The name can contain only alphanumeric characters and should
     *     not exceed 24 characters.
     * @param registerBody The body for the register request.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ErrorContractException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body on successful completion of {@link Mono}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<MetastoreRegistrationResponse> register(String id, MetastoreRegisterObject registerBody) {
        return this.serviceClient.registerAsync(id, registerBody);
    }

    /**
     * Gets status of the database.
     *
     * @param id The id parameter.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ErrorContractException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return status of the database along with {@link Response} on successful completion of {@link Mono}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<MetastoreRequestSuccessResponse>> getDatabaseOperationsWithResponse(String id) {
        return this.serviceClient.getDatabaseOperationsWithResponseAsync(id);
    }

    /**
     * Gets status of the database.
     *
     * @param id The id parameter.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ErrorContractException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return status of the database on successful completion of {@link Mono}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<MetastoreRequestSuccessResponse> getDatabaseOperations(String id) {
        return this.serviceClient.getDatabaseOperationsAsync(id);
    }

    /**
     * Update files in Syms.
     *
     * @param id The name of the database to be updated.
     * @param updateBody The body for the update request.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ErrorContractException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body along with {@link Response} on successful completion of {@link Mono}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<MetastoreUpdationResponse>> updateWithResponse(String id, MetastoreUpdateObject updateBody) {
        return this.serviceClient.updateWithResponseAsync(id, updateBody);
    }

    /**
     * Update files in Syms.
     *
     * @param id The name of the database to be updated.
     * @param updateBody The body for the update request.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ErrorContractException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body on successful completion of {@link Mono}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<MetastoreUpdationResponse> update(String id, MetastoreUpdateObject updateBody) {
        return this.serviceClient.updateAsync(id, updateBody);
    }

    /**
     * Remove files in Syms.
     *
     * @param id The id parameter.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ErrorContractException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link Response} on successful completion of {@link Mono}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<Void>> deleteWithResponse(String id) {
        return this.serviceClient.deleteWithResponseAsync(id);
    }

    /**
     * Remove files in Syms.
     *
     * @param id The id parameter.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ErrorContractException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return A {@link Mono} that completes when a successful response is received.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Void> delete(String id) {
        return this.serviceClient.deleteAsync(id);
    }
}
