// 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.RelationshipsImpl;
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 = RelationshipClientBuilder.class, isAsync = true)
public final class RelationshipAsyncClient {
    @Generated private final RelationshipsImpl serviceClient;

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

    /**
     * Create a new relationship between entities.
     *
     * <p><strong>Request Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     attributes (Optional): {
     *         String: Object (Optional)
     *     }
     *     typeName: String (Optional)
     *     lastModifiedTS: String (Optional)
     *     createTime: Float (Optional)
     *     createdBy: String (Optional)
     *     end1 (Optional): {
     *         guid: String (Optional)
     *         typeName: String (Optional)
     *         uniqueAttributes (Optional): {
     *             String: Object (Optional)
     *         }
     *     }
     *     end2 (Optional): (recursive schema, see end2 above)
     *     guid: String (Optional)
     *     homeId: String (Optional)
     *     label: String (Optional)
     *     provenanceType: Float (Optional)
     *     status: String(ACTIVE/DELETED) (Optional)
     *     updateTime: Float (Optional)
     *     updatedBy: String (Optional)
     *     version: Float (Optional)
     * }
     * }</pre>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     attributes (Optional): {
     *         String: Object (Optional)
     *     }
     *     typeName: String (Optional)
     *     lastModifiedTS: String (Optional)
     *     createTime: Float (Optional)
     *     createdBy: String (Optional)
     *     end1 (Optional): {
     *         guid: String (Optional)
     *         typeName: String (Optional)
     *         uniqueAttributes (Optional): {
     *             String: Object (Optional)
     *         }
     *     }
     *     end2 (Optional): (recursive schema, see end2 above)
     *     guid: String (Optional)
     *     homeId: String (Optional)
     *     label: String (Optional)
     *     provenanceType: Float (Optional)
     *     status: String(ACTIVE/DELETED) (Optional)
     *     updateTime: Float (Optional)
     *     updatedBy: String (Optional)
     *     version: Float (Optional)
     * }
     * }</pre>
     *
     * @param relationship The AtlasRelationship object containing the information for the relationship to be created.
     * @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 atlasRelationship along with {@link Response} on successful completion of {@link Mono}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> createWithResponse(BinaryData relationship, RequestOptions requestOptions) {
        return this.serviceClient.createWithResponseAsync(relationship, requestOptions);
    }

    /**
     * Update an existing relationship between entities.
     *
     * <p><strong>Request Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     attributes (Optional): {
     *         String: Object (Optional)
     *     }
     *     typeName: String (Optional)
     *     lastModifiedTS: String (Optional)
     *     createTime: Float (Optional)
     *     createdBy: String (Optional)
     *     end1 (Optional): {
     *         guid: String (Optional)
     *         typeName: String (Optional)
     *         uniqueAttributes (Optional): {
     *             String: Object (Optional)
     *         }
     *     }
     *     end2 (Optional): (recursive schema, see end2 above)
     *     guid: String (Optional)
     *     homeId: String (Optional)
     *     label: String (Optional)
     *     provenanceType: Float (Optional)
     *     status: String(ACTIVE/DELETED) (Optional)
     *     updateTime: Float (Optional)
     *     updatedBy: String (Optional)
     *     version: Float (Optional)
     * }
     * }</pre>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     attributes (Optional): {
     *         String: Object (Optional)
     *     }
     *     typeName: String (Optional)
     *     lastModifiedTS: String (Optional)
     *     createTime: Float (Optional)
     *     createdBy: String (Optional)
     *     end1 (Optional): {
     *         guid: String (Optional)
     *         typeName: String (Optional)
     *         uniqueAttributes (Optional): {
     *             String: Object (Optional)
     *         }
     *     }
     *     end2 (Optional): (recursive schema, see end2 above)
     *     guid: String (Optional)
     *     homeId: String (Optional)
     *     label: String (Optional)
     *     provenanceType: Float (Optional)
     *     status: String(ACTIVE/DELETED) (Optional)
     *     updateTime: Float (Optional)
     *     updatedBy: String (Optional)
     *     version: Float (Optional)
     * }
     * }</pre>
     *
     * @param relationship The AtlasRelationship object containing the information for the relationship to be created.
     * @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 atlasRelationship along with {@link Response} on successful completion of {@link Mono}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> updateWithResponse(BinaryData relationship, RequestOptions requestOptions) {
        return this.serviceClient.updateWithResponseAsync(relationship, requestOptions);
    }

    /**
     * Get relationship information between entities by its GUID.
     *
     * <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>extendedInfo</td><td>Boolean</td><td>No</td><td>Limits whether includes extended information.</td></tr>
     * </table>
     *
     * You can add these to a request with {@link RequestOptions#addQueryParam}
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     referredEntities (Optional): {
     *         String (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)
     *         }
     *     }
     *     relationship (Optional): {
     *         attributes (Optional): {
     *             String: Object (Optional)
     *         }
     *         typeName: String (Optional)
     *         lastModifiedTS: String (Optional)
     *         createTime: Float (Optional)
     *         createdBy: String (Optional)
     *         end1 (Optional): {
     *             guid: String (Optional)
     *             typeName: String (Optional)
     *             uniqueAttributes (Optional): {
     *                 String: Object (Optional)
     *             }
     *         }
     *         end2 (Optional): (recursive schema, see end2 above)
     *         guid: String (Optional)
     *         homeId: String (Optional)
     *         label: String (Optional)
     *         provenanceType: Float (Optional)
     *         status: String(ACTIVE/DELETED) (Optional)
     *         updateTime: Float (Optional)
     *         updatedBy: String (Optional)
     *         version: Float (Optional)
     *     }
     * }
     * }</pre>
     *
     * @param guid The globally unique identifier of the relationship.
     * @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 relationship information between entities by its GUID along with {@link Response} on successful
     *     completion of {@link Mono}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getWithResponse(String guid, RequestOptions requestOptions) {
        return this.serviceClient.getWithResponseAsync(guid, requestOptions);
    }

    /**
     * Delete a relationship between entities by its GUID.
     *
     * @param guid The globally unique identifier of the relationship.
     * @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>> deleteWithResponse(String guid, RequestOptions requestOptions) {
        return this.serviceClient.deleteWithResponseAsync(guid, requestOptions);
    }
}
