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

package azure.clientgenerator.core.clientdefaultvalue;

import azure.clientgenerator.core.clientdefaultvalue.implementation.ClientDefaultValueClientImpl;
import azure.clientgenerator.core.clientdefaultvalue.models.ModelWithDefaultValues;
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.exception.ClientAuthenticationException;
import com.azure.core.exception.HttpResponseException;
import com.azure.core.exception.ResourceModifiedException;
import com.azure.core.exception.ResourceNotFoundException;
import com.azure.core.http.HttpHeaderName;
import com.azure.core.http.rest.RequestOptions;
import com.azure.core.http.rest.Response;
import com.azure.core.util.BinaryData;
import com.azure.core.util.FluxUtil;
import reactor.core.publisher.Mono;

/**
 * Initializes a new instance of the asynchronous ClientDefaultValueClient type.
 */
@ServiceClient(builder = ClientDefaultValueClientBuilder.class, isAsync = true)
public final class ClientDefaultValueAsyncClient {
    @Generated
    private final ClientDefaultValueClientImpl serviceClient;

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

    /**
     * The putModelProperty operation.
     * <p><strong>Request Body Schema</strong></p>
     * 
     * <pre>
     * {@code
     * {
     *     name: String (Required)
     *     timeout: Integer (Optional)
     *     tier: String (Optional)
     *     retry: Boolean (Optional)
     * }
     * }
     * </pre>
     * 
     * <p><strong>Response Body Schema</strong></p>
     * 
     * <pre>
     * {@code
     * {
     *     name: String (Required)
     *     timeout: Integer (Optional)
     *     tier: String (Optional)
     *     retry: Boolean (Optional)
     * }
     * }
     * </pre>
     * 
     * @param body The body parameter.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
     * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
     * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
     * @return model with client default values on properties along with {@link Response} on successful completion of
     * {@link Mono}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> putModelPropertyWithResponse(BinaryData body, RequestOptions requestOptions) {
        return this.serviceClient.putModelPropertyWithResponseAsync(body, requestOptions);
    }

    /**
     * The getOperationParameter operation.
     * <p><strong>Query Parameters</strong></p>
     * <table border="1">
     * <caption>Query Parameters</caption>
     * <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     * <tr><td>pageSize</td><td>Integer</td><td>No</td><td>The pageSize parameter</td></tr>
     * <tr><td>format</td><td>String</td><td>No</td><td>The format parameter</td></tr>
     * </table>
     * You can add these to a request with {@link RequestOptions#addQueryParam}
     * 
     * @param name The name parameter.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
     * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
     * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
     * @return the {@link Response} on successful completion of {@link Mono}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<Void>> getOperationParameterWithResponse(String name, RequestOptions requestOptions) {
        return this.serviceClient.getOperationParameterWithResponseAsync(name, requestOptions);
    }

    /**
     * The getPathParameter operation.
     * 
     * @param segment1 The segment1 parameter.
     * @param segment2 The segment2 parameter.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
     * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
     * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
     * @return the {@link Response} on successful completion of {@link Mono}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<Void>> getPathParameterWithResponse(String segment1, String segment2,
        RequestOptions requestOptions) {
        return this.serviceClient.getPathParameterWithResponseAsync(segment1, segment2, requestOptions);
    }

    /**
     * The getHeaderParameter operation.
     * <p><strong>Header Parameters</strong></p>
     * <table border="1">
     * <caption>Header Parameters</caption>
     * <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     * <tr><td>Accept</td><td>String</td><td>No</td><td>The accept parameter</td></tr>
     * <tr><td>x-custom-header</td><td>String</td><td>No</td><td>The customHeader parameter</td></tr>
     * </table>
     * You can add these to a request with {@link RequestOptions#addHeader}
     * 
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
     * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
     * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
     * @return the {@link Response} on successful completion of {@link Mono}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<Void>> getHeaderParameterWithResponse(RequestOptions requestOptions) {
        return this.serviceClient.getHeaderParameterWithResponseAsync(requestOptions);
    }

    /**
     * The putModelProperty operation.
     * 
     * @param body The body parameter.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
     * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
     * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return model with client default values on properties on successful completion of {@link Mono}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<ModelWithDefaultValues> putModelProperty(ModelWithDefaultValues body) {
        // Generated convenience method for putModelPropertyWithResponse
        RequestOptions requestOptions = new RequestOptions();
        return putModelPropertyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono)
            .map(protocolMethodData -> protocolMethodData.toObject(ModelWithDefaultValues.class));
    }

    /**
     * The getOperationParameter operation.
     * 
     * @param name The name parameter.
     * @param pageSize The pageSize parameter.
     * @param format The format parameter.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
     * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
     * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
     * @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> getOperationParameter(String name, Integer pageSize, String format) {
        // Generated convenience method for getOperationParameterWithResponse
        RequestOptions requestOptions = new RequestOptions();
        if (pageSize != null) {
            requestOptions.addQueryParam("pageSize", String.valueOf(pageSize), false);
        }
        if (format != null) {
            requestOptions.addQueryParam("format", format, false);
        }
        return getOperationParameterWithResponse(name, requestOptions).flatMap(FluxUtil::toMono);
    }

    /**
     * The getOperationParameter operation.
     * 
     * @param name The name parameter.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
     * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
     * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
     * @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> getOperationParameter(String name) {
        // Generated convenience method for getOperationParameterWithResponse
        RequestOptions requestOptions = new RequestOptions();
        return getOperationParameterWithResponse(name, requestOptions).flatMap(FluxUtil::toMono);
    }

    /**
     * The getPathParameter operation.
     * 
     * @param segment1 The segment1 parameter.
     * @param segment2 The segment2 parameter.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
     * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
     * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
     * @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> getPathParameter(String segment1, String segment2) {
        // Generated convenience method for getPathParameterWithResponse
        RequestOptions requestOptions = new RequestOptions();
        return getPathParameterWithResponse(segment1, segment2, requestOptions).flatMap(FluxUtil::toMono);
    }

    /**
     * The getHeaderParameter operation.
     * 
     * @param accept The accept parameter.
     * @param customHeader The customHeader parameter.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
     * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
     * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
     * @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> getHeaderParameter(String accept, String customHeader) {
        // Generated convenience method for getHeaderParameterWithResponse
        RequestOptions requestOptions = new RequestOptions();
        if (accept != null) {
            requestOptions.setHeader(HttpHeaderName.ACCEPT, accept);
        }
        if (customHeader != null) {
            requestOptions.setHeader(HttpHeaderName.fromString("x-custom-header"), customHeader);
        }
        return getHeaderParameterWithResponse(requestOptions).flatMap(FluxUtil::toMono);
    }

    /**
     * The getHeaderParameter operation.
     * 
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
     * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
     * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
     * @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> getHeaderParameter() {
        // Generated convenience method for getHeaderParameterWithResponse
        RequestOptions requestOptions = new RequestOptions();
        return getHeaderParameterWithResponse(requestOptions).flatMap(FluxUtil::toMono);
    }
}
