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

package com.azure.analytics.purview.scanning;

import com.azure.analytics.purview.scanning.implementation.TriggersImpl;
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 reactor.core.publisher.Mono;

/** Initializes a new instance of the asynchronous PurviewScanningClient type. */
@ServiceClient(builder = PurviewScanningClientBuilder.class, isAsync = true)
public final class TriggersAsyncClient {
    @Generated private final TriggersImpl serviceClient;

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

    /**
     * Gets trigger information.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     id: String (Optional)
     *     name: String (Optional)
     *     properties (Optional): {
     *         recurrence (Optional): {
     *             frequency: String(Week/Month) (Optional)
     *             interval: Integer (Optional)
     *             startTime: OffsetDateTime (Optional)
     *             endTime: OffsetDateTime (Optional)
     *             schedule (Optional): {
     *                 additionalProperties (Optional): {
     *                     String: Object (Optional)
     *                 }
     *                 minutes (Optional): [
     *                     int (Optional)
     *                 ]
     *                 hours (Optional): [
     *                     int (Optional)
     *                 ]
     *                 weekDays (Optional): [
     *                     String(Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday) (Optional)
     *                 ]
     *                 monthDays (Optional): [
     *                     int (Optional)
     *                 ]
     *                 monthlyOccurrences (Optional): [
     *                      (Optional){
     *                         additionalProperties (Optional): {
     *                             String: Object (Optional)
     *                         }
     *                         day: String(Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday) (Optional)
     *                         occurrence: Integer (Optional)
     *                     }
     *                 ]
     *             }
     *             timeZone: String (Optional)
     *         }
     *         recurrenceInterval: String (Optional)
     *         createdAt: OffsetDateTime (Optional)
     *         lastModifiedAt: OffsetDateTime (Optional)
     *         lastScheduled: OffsetDateTime (Optional)
     *         scanLevel: String(Full/Incremental) (Optional)
     *         incrementalScanStartTime: OffsetDateTime (Optional)
     *     }
     * }
     * }</pre>
     *
     * @param dataSourceName The dataSourceName parameter.
     * @param scanName The scanName 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 trigger information along with {@link Response} on successful completion of {@link Mono}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getTriggerWithResponse(
            String dataSourceName, String scanName, RequestOptions requestOptions) {
        return this.serviceClient.getTriggerWithResponseAsync(dataSourceName, scanName, requestOptions);
    }

    /**
     * Creates an instance of a trigger.
     *
     * <p><strong>Request Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     id: String (Optional)
     *     name: String (Optional)
     *     properties (Optional): {
     *         recurrence (Optional): {
     *             frequency: String(Week/Month) (Optional)
     *             interval: Integer (Optional)
     *             startTime: OffsetDateTime (Optional)
     *             endTime: OffsetDateTime (Optional)
     *             schedule (Optional): {
     *                 additionalProperties (Optional): {
     *                     String: Object (Optional)
     *                 }
     *                 minutes (Optional): [
     *                     int (Optional)
     *                 ]
     *                 hours (Optional): [
     *                     int (Optional)
     *                 ]
     *                 weekDays (Optional): [
     *                     String(Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday) (Optional)
     *                 ]
     *                 monthDays (Optional): [
     *                     int (Optional)
     *                 ]
     *                 monthlyOccurrences (Optional): [
     *                      (Optional){
     *                         additionalProperties (Optional): {
     *                             String: Object (Optional)
     *                         }
     *                         day: String(Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday) (Optional)
     *                         occurrence: Integer (Optional)
     *                     }
     *                 ]
     *             }
     *             timeZone: String (Optional)
     *         }
     *         recurrenceInterval: String (Optional)
     *         createdAt: OffsetDateTime (Optional)
     *         lastModifiedAt: OffsetDateTime (Optional)
     *         lastScheduled: OffsetDateTime (Optional)
     *         scanLevel: String(Full/Incremental) (Optional)
     *         incrementalScanStartTime: OffsetDateTime (Optional)
     *     }
     * }
     * }</pre>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     id: String (Optional)
     *     name: String (Optional)
     *     properties (Optional): {
     *         recurrence (Optional): {
     *             frequency: String(Week/Month) (Optional)
     *             interval: Integer (Optional)
     *             startTime: OffsetDateTime (Optional)
     *             endTime: OffsetDateTime (Optional)
     *             schedule (Optional): {
     *                 additionalProperties (Optional): {
     *                     String: Object (Optional)
     *                 }
     *                 minutes (Optional): [
     *                     int (Optional)
     *                 ]
     *                 hours (Optional): [
     *                     int (Optional)
     *                 ]
     *                 weekDays (Optional): [
     *                     String(Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday) (Optional)
     *                 ]
     *                 monthDays (Optional): [
     *                     int (Optional)
     *                 ]
     *                 monthlyOccurrences (Optional): [
     *                      (Optional){
     *                         additionalProperties (Optional): {
     *                             String: Object (Optional)
     *                         }
     *                         day: String(Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday) (Optional)
     *                         occurrence: Integer (Optional)
     *                     }
     *                 ]
     *             }
     *             timeZone: String (Optional)
     *         }
     *         recurrenceInterval: String (Optional)
     *         createdAt: OffsetDateTime (Optional)
     *         lastModifiedAt: OffsetDateTime (Optional)
     *         lastScheduled: OffsetDateTime (Optional)
     *         scanLevel: String(Full/Incremental) (Optional)
     *         incrementalScanStartTime: OffsetDateTime (Optional)
     *     }
     * }
     * }</pre>
     *
     * @param dataSourceName The dataSourceName parameter.
     * @param scanName The scanName parameter.
     * @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 the response body along with {@link Response} on successful completion of {@link Mono}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> createTriggerWithResponse(
            String dataSourceName, String scanName, BinaryData body, RequestOptions requestOptions) {
        return this.serviceClient.createTriggerWithResponseAsync(dataSourceName, scanName, body, requestOptions);
    }

    /**
     * Deletes the trigger associated with the scan.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     id: String (Optional)
     *     name: String (Optional)
     *     properties (Optional): {
     *         recurrence (Optional): {
     *             frequency: String(Week/Month) (Optional)
     *             interval: Integer (Optional)
     *             startTime: OffsetDateTime (Optional)
     *             endTime: OffsetDateTime (Optional)
     *             schedule (Optional): {
     *                 additionalProperties (Optional): {
     *                     String: Object (Optional)
     *                 }
     *                 minutes (Optional): [
     *                     int (Optional)
     *                 ]
     *                 hours (Optional): [
     *                     int (Optional)
     *                 ]
     *                 weekDays (Optional): [
     *                     String(Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday) (Optional)
     *                 ]
     *                 monthDays (Optional): [
     *                     int (Optional)
     *                 ]
     *                 monthlyOccurrences (Optional): [
     *                      (Optional){
     *                         additionalProperties (Optional): {
     *                             String: Object (Optional)
     *                         }
     *                         day: String(Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday) (Optional)
     *                         occurrence: Integer (Optional)
     *                     }
     *                 ]
     *             }
     *             timeZone: String (Optional)
     *         }
     *         recurrenceInterval: String (Optional)
     *         createdAt: OffsetDateTime (Optional)
     *         lastModifiedAt: OffsetDateTime (Optional)
     *         lastScheduled: OffsetDateTime (Optional)
     *         scanLevel: String(Full/Incremental) (Optional)
     *         incrementalScanStartTime: OffsetDateTime (Optional)
     *     }
     * }
     * }</pre>
     *
     * @param dataSourceName The dataSourceName parameter.
     * @param scanName The scanName 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 response body along with {@link Response} on successful completion of {@link Mono}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> deleteTriggerWithResponse(
            String dataSourceName, String scanName, RequestOptions requestOptions) {
        return this.serviceClient.deleteTriggerWithResponseAsync(dataSourceName, scanName, requestOptions);
    }
}
