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

package com.azure.verticals.agrifood.farming;

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.rest.RequestOptions;
import com.azure.core.http.rest.Response;
import com.azure.core.util.BinaryData;
import com.azure.verticals.agrifood.farming.implementation.SensorEventsImpl;
import reactor.core.publisher.Mono;

/** Initializes a new instance of the asynchronous FarmBeatsClient type. */
@ServiceClient(builder = SensorEventsClientBuilder.class, isAsync = true)
public final class SensorEventsAsyncClient {
    @Generated private final SensorEventsImpl serviceClient;

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

    /**
     * Returns a list of sensor events data. Time span for query is limited to 90 days at a time. Returns last 90 days
     * events when startDateTime and endDateTime are not provided.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>startDateTime</td><td>OffsetDateTime</td><td>No</td><td>Search span start time of sensor events (inclusive), sample format: yyyy-MM-ddTHH:mm:ssZ.
     * It is truncated upto seconds if fraction is provided.</td></tr>
     *     <tr><td>endDateTime</td><td>OffsetDateTime</td><td>No</td><td>Search span end time of sensor events (inclusive), sample format: yyyy-MM-ddTHH:mm:ssZ.
     * It is truncated upto seconds if fraction is provided.</td></tr>
     *     <tr><td>excludeDuplicateEvents</td><td>Boolean</td><td>No</td><td>Flag to exclude duplicate events and take the latest ones only (Default: true).</td></tr>
     * </table>
     *
     * You can add these to a request with {@link RequestOptions#addQueryParam}
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value (Required): [
     *          (Required){
     *             sensorId: String (Optional)
     *             sensorPartnerId: String (Optional)
     *             partyId: String (Optional)
     *             boundaryId: String (Optional)
     *             eventDateTime: OffsetDateTime (Optional)
     *             ingestionDateTime: OffsetDateTime (Optional)
     *             measures (Optional): {
     *                 String: Object (Optional)
     *             }
     *         }
     *     ]
     *     skipToken: String (Optional)
     *     nextLink: String (Optional)
     * }
     * }</pre>
     *
     * @param sensorId Id of the associated sensor.
     * @param sensorPartnerId Id of the associated sensor partner.
     * @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 paged response contains list of requested objects and a URL link to get the next set of results along
     *     with {@link Response} on successful completion of {@link Mono}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> listWithResponse(
            String sensorId, String sensorPartnerId, RequestOptions requestOptions) {
        return this.serviceClient.listWithResponseAsync(sensorId, sensorPartnerId, requestOptions);
    }
}
