// 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.catalog;

import com.azure.analytics.purview.catalog.implementation.CollectionsImpl;
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 PurviewCatalogClient type. */
@ServiceClient(builder = CollectionClientBuilder.class, isAsync = true)
public final class CollectionAsyncClient {
    @Generated private final CollectionsImpl serviceClient;

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

    /**
     * Creates or updates an entity to a collection. Existing entity is matched using its unique guid if supplied or by
     * its unique attributes eg: qualifiedName. Map and array of collections are not well supported. E.g.,
     * array&lt;array&lt;int&gt;&gt;, array&lt;map&lt;string, int&gt;&gt;.
     *
     * <p><strong>Request Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     referredEntities (Optional): {
     *         String (Optional): {
     *             attributes (Optional): {
     *                 String: Object (Optional)
     *             }
     *             typeName: String (Optional)
     *             lastModifiedTS: String (Optional)
     *             businessAttributes (Optional): {
     *                 String: Object (Optional)
     *             }
     *             classifications (Optional): [
     *                  (Optional){
     *                     attributes (Optional): {
     *                         String: Object (Optional)
     *                     }
     *                     typeName: String (Optional)
     *                     lastModifiedTS: String (Optional)
     *                     entityGuid: String (Optional)
     *                     entityStatus: String(ACTIVE/DELETED) (Optional)
     *                     removePropagationsOnEntityDelete: Boolean (Optional)
     *                     validityPeriods (Optional): [
     *                          (Optional){
     *                             endTime: String (Optional)
     *                             startTime: String (Optional)
     *                             timeZone: String (Optional)
     *                         }
     *                     ]
     *                     source: String (Optional)
     *                     sourceDetails (Optional): {
     *                         String: Object (Optional)
     *                     }
     *                 }
     *             ]
     *             createTime: Float (Optional)
     *             createdBy: String (Optional)
     *             customAttributes (Optional): {
     *                 String: String (Optional)
     *             }
     *             guid: String (Optional)
     *             homeId: String (Optional)
     *             isIncomplete: Boolean (Optional)
     *             labels (Optional): [
     *                 String (Optional)
     *             ]
     *             meanings (Optional): [
     *                  (Optional){
     *                     confidence: Integer (Optional)
     *                     createdBy: String (Optional)
     *                     description: String (Optional)
     *                     displayText: String (Optional)
     *                     expression: String (Optional)
     *                     relationGuid: String (Optional)
     *                     source: String (Optional)
     *                     status: String(DISCOVERED/PROPOSED/IMPORTED/VALIDATED/DEPRECATED/OBSOLETE/OTHER) (Optional)
     *                     steward: String (Optional)
     *                     termGuid: String (Optional)
     *                 }
     *             ]
     *             provenanceType: Float (Optional)
     *             proxy: Boolean (Optional)
     *             relationshipAttributes (Optional): {
     *                 String: Object (Optional)
     *             }
     *             status: String(ACTIVE/DELETED) (Optional)
     *             updateTime: Float (Optional)
     *             updatedBy: String (Optional)
     *             version: Float (Optional)
     *             source: String (Optional)
     *             sourceDetails (Optional): {
     *                 String: Object (Optional)
     *             }
     *             contacts (Optional): {
     *                 String (Optional): [
     *                      (Optional){
     *                         id: String (Optional)
     *                         info: String (Optional)
     *                     }
     *                 ]
     *             }
     *         }
     *     }
     *     entity (Optional): (recursive schema, see entity above)
     * }
     * }</pre>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     guidAssignments (Optional): {
     *         String: String (Optional)
     *     }
     *     mutatedEntities (Optional): {
     *         String (Optional): [
     *              (Optional){
     *                 attributes (Optional): {
     *                     String: Object (Optional)
     *                 }
     *                 typeName: String (Optional)
     *                 lastModifiedTS: String (Optional)
     *                 classificationNames (Optional): [
     *                     String (Optional)
     *                 ]
     *                 classifications (Optional): [
     *                      (Optional){
     *                         attributes (Optional): {
     *                             String: Object (Optional)
     *                         }
     *                         typeName: String (Optional)
     *                         lastModifiedTS: String (Optional)
     *                         entityGuid: String (Optional)
     *                         entityStatus: String(ACTIVE/DELETED) (Optional)
     *                         removePropagationsOnEntityDelete: Boolean (Optional)
     *                         validityPeriods (Optional): [
     *                              (Optional){
     *                                 endTime: String (Optional)
     *                                 startTime: String (Optional)
     *                                 timeZone: String (Optional)
     *                             }
     *                         ]
     *                         source: String (Optional)
     *                         sourceDetails (Optional): {
     *                             String: Object (Optional)
     *                         }
     *                     }
     *                 ]
     *                 displayText: String (Optional)
     *                 guid: String (Optional)
     *                 isIncomplete: Boolean (Optional)
     *                 labels (Optional): [
     *                     String (Optional)
     *                 ]
     *                 meaningNames (Optional): [
     *                     String (Optional)
     *                 ]
     *                 meanings (Optional): [
     *                      (Optional){
     *                         confidence: Integer (Optional)
     *                         createdBy: String (Optional)
     *                         description: String (Optional)
     *                         displayText: String (Optional)
     *                         expression: String (Optional)
     *                         relationGuid: String (Optional)
     *                         source: String (Optional)
     *                         status: String(DISCOVERED/PROPOSED/IMPORTED/VALIDATED/DEPRECATED/OBSOLETE/OTHER) (Optional)
     *                         steward: String (Optional)
     *                         termGuid: String (Optional)
     *                     }
     *                 ]
     *                 status: String(ACTIVE/DELETED) (Optional)
     *             }
     *         ]
     *     }
     *     partialUpdatedEntities (Optional): [
     *         (recursive schema, see above)
     *     ]
     * }
     * }</pre>
     *
     * @param collection the collection unique name.
     * @param entity Atlas entity with extended information.
     * @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 entityMutationResponse along with {@link Response} on successful completion of {@link Mono}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> createOrUpdateWithResponse(
            String collection, BinaryData entity, RequestOptions requestOptions) {
        return this.serviceClient.createOrUpdateWithResponseAsync(collection, entity, requestOptions);
    }

    /**
     * Creates or updates entities in bulk to a collection. Existing entity is matched using its unique guid if supplied
     * or by its unique attributes eg: qualifiedName. Map and array of collections are not well supported. E.g.,
     * array&lt;array&lt;int&gt;&gt;, array&lt;map&lt;string, int&gt;&gt;.
     *
     * <p><strong>Request Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     referredEntities (Optional): {
     *         String (Optional): {
     *             attributes (Optional): {
     *                 String: Object (Optional)
     *             }
     *             typeName: String (Optional)
     *             lastModifiedTS: String (Optional)
     *             businessAttributes (Optional): {
     *                 String: Object (Optional)
     *             }
     *             classifications (Optional): [
     *                  (Optional){
     *                     attributes (Optional): {
     *                         String: Object (Optional)
     *                     }
     *                     typeName: String (Optional)
     *                     lastModifiedTS: String (Optional)
     *                     entityGuid: String (Optional)
     *                     entityStatus: String(ACTIVE/DELETED) (Optional)
     *                     removePropagationsOnEntityDelete: Boolean (Optional)
     *                     validityPeriods (Optional): [
     *                          (Optional){
     *                             endTime: String (Optional)
     *                             startTime: String (Optional)
     *                             timeZone: String (Optional)
     *                         }
     *                     ]
     *                     source: String (Optional)
     *                     sourceDetails (Optional): {
     *                         String: Object (Optional)
     *                     }
     *                 }
     *             ]
     *             createTime: Float (Optional)
     *             createdBy: String (Optional)
     *             customAttributes (Optional): {
     *                 String: String (Optional)
     *             }
     *             guid: String (Optional)
     *             homeId: String (Optional)
     *             isIncomplete: Boolean (Optional)
     *             labels (Optional): [
     *                 String (Optional)
     *             ]
     *             meanings (Optional): [
     *                  (Optional){
     *                     confidence: Integer (Optional)
     *                     createdBy: String (Optional)
     *                     description: String (Optional)
     *                     displayText: String (Optional)
     *                     expression: String (Optional)
     *                     relationGuid: String (Optional)
     *                     source: String (Optional)
     *                     status: String(DISCOVERED/PROPOSED/IMPORTED/VALIDATED/DEPRECATED/OBSOLETE/OTHER) (Optional)
     *                     steward: String (Optional)
     *                     termGuid: String (Optional)
     *                 }
     *             ]
     *             provenanceType: Float (Optional)
     *             proxy: Boolean (Optional)
     *             relationshipAttributes (Optional): {
     *                 String: Object (Optional)
     *             }
     *             status: String(ACTIVE/DELETED) (Optional)
     *             updateTime: Float (Optional)
     *             updatedBy: String (Optional)
     *             version: Float (Optional)
     *             source: String (Optional)
     *             sourceDetails (Optional): {
     *                 String: Object (Optional)
     *             }
     *             contacts (Optional): {
     *                 String (Optional): [
     *                      (Optional){
     *                         id: String (Optional)
     *                         info: String (Optional)
     *                     }
     *                 ]
     *             }
     *         }
     *     }
     *     entities (Optional): [
     *         (recursive schema, see above)
     *     ]
     * }
     * }</pre>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     guidAssignments (Optional): {
     *         String: String (Optional)
     *     }
     *     mutatedEntities (Optional): {
     *         String (Optional): [
     *              (Optional){
     *                 attributes (Optional): {
     *                     String: Object (Optional)
     *                 }
     *                 typeName: String (Optional)
     *                 lastModifiedTS: String (Optional)
     *                 classificationNames (Optional): [
     *                     String (Optional)
     *                 ]
     *                 classifications (Optional): [
     *                      (Optional){
     *                         attributes (Optional): {
     *                             String: Object (Optional)
     *                         }
     *                         typeName: String (Optional)
     *                         lastModifiedTS: String (Optional)
     *                         entityGuid: String (Optional)
     *                         entityStatus: String(ACTIVE/DELETED) (Optional)
     *                         removePropagationsOnEntityDelete: Boolean (Optional)
     *                         validityPeriods (Optional): [
     *                              (Optional){
     *                                 endTime: String (Optional)
     *                                 startTime: String (Optional)
     *                                 timeZone: String (Optional)
     *                             }
     *                         ]
     *                         source: String (Optional)
     *                         sourceDetails (Optional): {
     *                             String: Object (Optional)
     *                         }
     *                     }
     *                 ]
     *                 displayText: String (Optional)
     *                 guid: String (Optional)
     *                 isIncomplete: Boolean (Optional)
     *                 labels (Optional): [
     *                     String (Optional)
     *                 ]
     *                 meaningNames (Optional): [
     *                     String (Optional)
     *                 ]
     *                 meanings (Optional): [
     *                      (Optional){
     *                         confidence: Integer (Optional)
     *                         createdBy: String (Optional)
     *                         description: String (Optional)
     *                         displayText: String (Optional)
     *                         expression: String (Optional)
     *                         relationGuid: String (Optional)
     *                         source: String (Optional)
     *                         status: String(DISCOVERED/PROPOSED/IMPORTED/VALIDATED/DEPRECATED/OBSOLETE/OTHER) (Optional)
     *                         steward: String (Optional)
     *                         termGuid: String (Optional)
     *                     }
     *                 ]
     *                 status: String(ACTIVE/DELETED) (Optional)
     *             }
     *         ]
     *     }
     *     partialUpdatedEntities (Optional): [
     *         (recursive schema, see above)
     *     ]
     * }
     * }</pre>
     *
     * @param collection the collection unique name.
     * @param entities Atlas entities with extended information.
     * @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 entityMutationResponse along with {@link Response} on successful completion of {@link Mono}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> createOrUpdateBulkWithResponse(
            String collection, BinaryData entities, RequestOptions requestOptions) {
        return this.serviceClient.createOrUpdateBulkWithResponseAsync(collection, entities, requestOptions);
    }

    /**
     * Move existing entities to the target collection.
     *
     * <p><strong>Request Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     entityGuids (Optional): [
     *         String (Optional)
     *     ]
     * }
     * }</pre>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     guidAssignments (Optional): {
     *         String: String (Optional)
     *     }
     *     mutatedEntities (Optional): {
     *         String (Optional): [
     *              (Optional){
     *                 attributes (Optional): {
     *                     String: Object (Optional)
     *                 }
     *                 typeName: String (Optional)
     *                 lastModifiedTS: String (Optional)
     *                 classificationNames (Optional): [
     *                     String (Optional)
     *                 ]
     *                 classifications (Optional): [
     *                      (Optional){
     *                         attributes (Optional): {
     *                             String: Object (Optional)
     *                         }
     *                         typeName: String (Optional)
     *                         lastModifiedTS: String (Optional)
     *                         entityGuid: String (Optional)
     *                         entityStatus: String(ACTIVE/DELETED) (Optional)
     *                         removePropagationsOnEntityDelete: Boolean (Optional)
     *                         validityPeriods (Optional): [
     *                              (Optional){
     *                                 endTime: String (Optional)
     *                                 startTime: String (Optional)
     *                                 timeZone: String (Optional)
     *                             }
     *                         ]
     *                         source: String (Optional)
     *                         sourceDetails (Optional): {
     *                             String: Object (Optional)
     *                         }
     *                     }
     *                 ]
     *                 displayText: String (Optional)
     *                 guid: String (Optional)
     *                 isIncomplete: Boolean (Optional)
     *                 labels (Optional): [
     *                     String (Optional)
     *                 ]
     *                 meaningNames (Optional): [
     *                     String (Optional)
     *                 ]
     *                 meanings (Optional): [
     *                      (Optional){
     *                         confidence: Integer (Optional)
     *                         createdBy: String (Optional)
     *                         description: String (Optional)
     *                         displayText: String (Optional)
     *                         expression: String (Optional)
     *                         relationGuid: String (Optional)
     *                         source: String (Optional)
     *                         status: String(DISCOVERED/PROPOSED/IMPORTED/VALIDATED/DEPRECATED/OBSOLETE/OTHER) (Optional)
     *                         steward: String (Optional)
     *                         termGuid: String (Optional)
     *                     }
     *                 ]
     *                 status: String(ACTIVE/DELETED) (Optional)
     *             }
     *         ]
     *     }
     *     partialUpdatedEntities (Optional): [
     *         (recursive schema, see above)
     *     ]
     * }
     * }</pre>
     *
     * @param collection the collection unique name.
     * @param moveEntitiesRequest Entity guids to be moved to target collection.
     * @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 entityMutationResponse along with {@link Response} on successful completion of {@link Mono}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> moveEntitiesToCollectionWithResponse(
            String collection, BinaryData moveEntitiesRequest, RequestOptions requestOptions) {
        return this.serviceClient.moveEntitiesToCollectionWithResponseAsync(
                collection, moveEntitiesRequest, requestOptions);
    }
}
