// 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.PagedFlux;
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.polling.PollerFlux;
import com.azure.verticals.agrifood.farming.implementation.ScenesImpl;
import reactor.core.publisher.Mono;

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

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

    /**
     * Returns a paginated list of scene resources.
     *
     * <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>Scene start UTC datetime (inclusive), sample format: yyyy-MM-ddThh:mm:ssZ.</td></tr>
     *     <tr><td>endDateTime</td><td>OffsetDateTime</td><td>No</td><td>Scene end UTC datetime (inclusive), sample format: yyyy-MM-dThh:mm:ssZ.</td></tr>
     *     <tr><td>maxCloudCoveragePercentage</td><td>Double</td><td>No</td><td>Filter scenes with cloud coverage percentage less than max value. Range [0 to 100.0].</td></tr>
     *     <tr><td>maxDarkPixelCoveragePercentage</td><td>Double</td><td>No</td><td>Filter scenes with dark pixel coverage percentage less than max value. Range [0 to 100.0].</td></tr>
     *     <tr><td>imageNames</td><td>List&lt;String&gt;</td><td>No</td><td>List of image names to be filtered. Call {@link RequestOptions#addQueryParam} to add string to array.</td></tr>
     *     <tr><td>imageResolutions</td><td>List&lt;Double&gt;</td><td>No</td><td>List of image resolutions in meters to be filtered. Call {@link RequestOptions#addQueryParam} to add string to array.</td></tr>
     *     <tr><td>imageFormats</td><td>List&lt;String&gt;</td><td>No</td><td>List of image formats to be filtered. Call {@link RequestOptions#addQueryParam} to add string to array.</td></tr>
     *     <tr><td>maxPageSize</td><td>Integer</td><td>No</td><td>Maximum number of items needed (inclusive).
     * Minimum = 10, Maximum = 1000, Default value = 50.</td></tr>
     *     <tr><td>skipToken</td><td>String</td><td>No</td><td>Skip token for getting next set of results.</td></tr>
     * </table>
     *
     * You can add these to a request with {@link RequestOptions#addQueryParam}
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     sceneDateTime: OffsetDateTime (Optional)
     *     provider: String (Optional)
     *     source: String (Optional)
     *     imageFiles (Optional): [
     *          (Optional){
     *             fileLink: String (Optional)
     *             name: String (Required)
     *             imageFormat: String(TIF) (Optional)
     *             resolution: Double (Optional)
     *         }
     *     ]
     *     imageFormat: String(TIF) (Optional)
     *     cloudCoverPercentage: Double (Optional)
     *     darkPixelPercentage: Double (Optional)
     *     ndviMedianValue: Double (Optional)
     *     boundaryId: String (Optional)
     *     partyId: String (Optional)
     *     id: String (Optional)
     *     eTag: String (Optional)
     * }
     * }</pre>
     *
     * @param provider Provider name of scene data.
     * @param partyId PartyId.
     * @param boundaryId BoundaryId.
     * @param source Source name of scene data, Available Values: Sentinel_2_L2A, Sentinel_2_L1C.
     * @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 as
     *     paginated response with {@link PagedFlux}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> list(
            String provider, String partyId, String boundaryId, String source, RequestOptions requestOptions) {
        return this.serviceClient.listAsync(provider, partyId, boundaryId, source, requestOptions);
    }

    /**
     * Downloads and returns file Stream as response for the given input filePath.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * BinaryData
     * }</pre>
     *
     * @param filePath cloud storage path of scene file.
     * @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 response body along with {@link Response} on successful completion of {@link Mono}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> downloadWithResponse(String filePath, RequestOptions requestOptions) {
        return this.serviceClient.downloadWithResponseAsync(filePath, requestOptions);
    }

    /**
     * Create a satellite data ingestion job.
     *
     * <p><strong>Request Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     partyId: String (Required)
     *     boundaryId: String (Required)
     *     startDateTime: OffsetDateTime (Required)
     *     endDateTime: OffsetDateTime (Required)
     *     provider: String(Microsoft) (Optional)
     *     source: String(Sentinel_2_L2A/Sentinel_2_L1C) (Required)
     *     data (Optional): {
     *         imageNames (Optional): [
     *             String (Optional)
     *         ]
     *         imageFormats (Optional): [
     *             String (Optional)
     *         ]
     *         imageResolutions (Optional): [
     *             double (Optional)
     *         ]
     *     }
     *     id: String (Optional)
     *     status: String (Optional)
     *     durationInSeconds: Double (Optional)
     *     message: String (Optional)
     *     errorCode: String (Optional)
     *     createdDateTime: OffsetDateTime (Optional)
     *     lastActionDateTime: OffsetDateTime (Optional)
     *     startTime: OffsetDateTime (Optional)
     *     endTime: OffsetDateTime (Optional)
     *     name: String (Optional)
     *     description: String (Optional)
     *     createdBy: String (Optional)
     *     modifiedBy: String (Optional)
     *     properties (Optional): {
     *         String: Object (Optional)
     *     }
     * }
     * }</pre>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     partyId: String (Required)
     *     boundaryId: String (Required)
     *     startDateTime: OffsetDateTime (Required)
     *     endDateTime: OffsetDateTime (Required)
     *     provider: String(Microsoft) (Optional)
     *     source: String(Sentinel_2_L2A/Sentinel_2_L1C) (Required)
     *     data (Optional): {
     *         imageNames (Optional): [
     *             String (Optional)
     *         ]
     *         imageFormats (Optional): [
     *             String (Optional)
     *         ]
     *         imageResolutions (Optional): [
     *             double (Optional)
     *         ]
     *     }
     *     id: String (Optional)
     *     status: String (Optional)
     *     durationInSeconds: Double (Optional)
     *     message: String (Optional)
     *     errorCode: String (Optional)
     *     createdDateTime: OffsetDateTime (Optional)
     *     lastActionDateTime: OffsetDateTime (Optional)
     *     startTime: OffsetDateTime (Optional)
     *     endTime: OffsetDateTime (Optional)
     *     name: String (Optional)
     *     description: String (Optional)
     *     createdBy: String (Optional)
     *     modifiedBy: String (Optional)
     *     properties (Optional): {
     *         String: Object (Optional)
     *     }
     * }
     * }</pre>
     *
     * @param jobId JobId provided by user.
     * @param job Job parameters supplied by user.
     * @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 PollerFlux} for polling of schema of satellite data ingestion job.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public PollerFlux<BinaryData, BinaryData> beginCreateSatelliteDataIngestionJob(
            String jobId, BinaryData job, RequestOptions requestOptions) {
        return this.serviceClient.beginCreateSatelliteDataIngestionJobAsync(jobId, job, requestOptions);
    }

    /**
     * Get a satellite data ingestion job.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     partyId: String (Required)
     *     boundaryId: String (Required)
     *     startDateTime: OffsetDateTime (Required)
     *     endDateTime: OffsetDateTime (Required)
     *     provider: String(Microsoft) (Optional)
     *     source: String(Sentinel_2_L2A/Sentinel_2_L1C) (Required)
     *     data (Optional): {
     *         imageNames (Optional): [
     *             String (Optional)
     *         ]
     *         imageFormats (Optional): [
     *             String (Optional)
     *         ]
     *         imageResolutions (Optional): [
     *             double (Optional)
     *         ]
     *     }
     *     id: String (Optional)
     *     status: String (Optional)
     *     durationInSeconds: Double (Optional)
     *     message: String (Optional)
     *     errorCode: String (Optional)
     *     createdDateTime: OffsetDateTime (Optional)
     *     lastActionDateTime: OffsetDateTime (Optional)
     *     startTime: OffsetDateTime (Optional)
     *     endTime: OffsetDateTime (Optional)
     *     name: String (Optional)
     *     description: String (Optional)
     *     createdBy: String (Optional)
     *     modifiedBy: String (Optional)
     *     properties (Optional): {
     *         String: Object (Optional)
     *     }
     * }
     * }</pre>
     *
     * @param jobId Id of the job.
     * @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 a satellite data ingestion job along with {@link Response} on successful completion of {@link Mono}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getSatelliteDataIngestionJobDetailsWithResponse(
            String jobId, RequestOptions requestOptions) {
        return this.serviceClient.getSatelliteDataIngestionJobDetailsWithResponseAsync(jobId, requestOptions);
    }

    /**
     * Search for STAC features by collection id, bbox, intersecting geometry, start and end datetime.
     *
     * <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>maxpagesize</td><td>Integer</td><td>No</td><td>Maximum number of features needed (inclusive). Minimum = 1, Maximum = 100, Default value = 10.</td></tr>
     *     <tr><td>skip</td><td>Integer</td><td>No</td><td>Skip token for getting next set of results.</td></tr>
     * </table>
     *
     * You can add these to a request with {@link RequestOptions#addQueryParam}
     *
     * <p><strong>Request Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     startDateTime: OffsetDateTime (Required)
     *     endDateTime: OffsetDateTime (Required)
     *     intersects (Optional): {
     *     }
     *     bbox (Optional): [
     *         double (Optional)
     *     ]
     *     featureIds (Optional): [
     *         String (Optional)
     *     ]
     * }
     * }</pre>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     features (Required): [
     *          (Required){
     *             stacVersion: String (Required)
     *             stacExtensions (Optional): [
     *                 String (Optional)
     *             ]
     *             id: String (Required)
     *             type: String (Required)
     *             geometry: Object (Optional)
     *             bbox (Optional): [
     *                 double (Optional)
     *             ]
     *             properties: Object (Required)
     *             links (Required): [
     *                  (Required){
     *                     href: String (Required)
     *                     rel: String (Required)
     *                     type: String (Optional)
     *                     title: String (Optional)
     *                 }
     *             ]
     *             assets (Required): {
     *                 String (Required): {
     *                     href: String (Required)
     *                     title: String (Optional)
     *                     description: String (Optional)
     *                     type: String (Optional)
     *                     roles (Optional): [
     *                         String (Optional)
     *                     ]
     *                 }
     *             }
     *             collection: String (Optional)
     *         }
     *     ]
     *     nextLink: String (Optional)
     * }
     * }</pre>
     *
     * @param collectionId Collection Id to be searched. Allowed values: "Sentinel_2_L2A", "Sentinel_2_L1C".
     * @param searchFeaturesQuery Query filters.
     * @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 features and next property 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>> searchFeaturesWithResponse(
            String collectionId, BinaryData searchFeaturesQuery, RequestOptions requestOptions) {
        return this.serviceClient.searchFeaturesWithResponseAsync(collectionId, searchFeaturesQuery, requestOptions);
    }

    /**
     * Get a feature(SpatioTemporal Asset Catalog (STAC) Item) for given collection and feature id.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     stacVersion: String (Required)
     *     stacExtensions (Optional): [
     *         String (Optional)
     *     ]
     *     id: String (Required)
     *     type: String (Required)
     *     geometry: Object (Optional)
     *     bbox (Optional): [
     *         double (Optional)
     *     ]
     *     properties: Object (Required)
     *     links (Required): [
     *          (Required){
     *             href: String (Required)
     *             rel: String (Required)
     *             type: String (Optional)
     *             title: String (Optional)
     *         }
     *     ]
     *     assets (Required): {
     *         String (Required): {
     *             href: String (Required)
     *             title: String (Optional)
     *             description: String (Optional)
     *             type: String (Optional)
     *             roles (Optional): [
     *                 String (Optional)
     *             ]
     *         }
     *     }
     *     collection: String (Optional)
     * }
     * }</pre>
     *
     * @param collectionId Collection Id to be fetched. Allowed values: "Sentinel_2_L2A", "Sentinel_2_L1C".
     * @param featureId Feature Id to be fetched.
     * @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 a feature(SpatioTemporal Asset Catalog (STAC) Item) for given collection and feature id along with {@link
     *     Response} on successful completion of {@link Mono}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getStacFeatureWithResponse(
            String collectionId, String featureId, RequestOptions requestOptions) {
        return this.serviceClient.getStacFeatureWithResponseAsync(collectionId, featureId, requestOptions);
    }
}
