"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.DatabaseRecommendedActionsImpl = void 0;
const tslib_1 = require("tslib");
const coreClient = tslib_1.__importStar(require("@azure/core-client"));
const Mappers = tslib_1.__importStar(require("../models/mappers.js"));
const Parameters = tslib_1.__importStar(require("../models/parameters.js"));
/** Class containing DatabaseRecommendedActions operations. */
class DatabaseRecommendedActionsImpl {
    client;
    /**
     * Initialize a new instance of the class DatabaseRecommendedActions class.
     * @param client Reference to the service client
     */
    constructor(client) {
        this.client = client;
    }
    /**
     * Gets list of Database Recommended Actions.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain
     *                          this value from the Azure Resource Manager API or the portal.
     * @param serverName The name of the server.
     * @param databaseName The name of the database.
     * @param advisorName The name of the Database Advisor.
     * @param options The options parameters.
     */
    listByDatabaseAdvisor(resourceGroupName, serverName, databaseName, advisorName, options) {
        return this.client.sendOperationRequest({ resourceGroupName, serverName, databaseName, advisorName, options }, listByDatabaseAdvisorOperationSpec);
    }
    /**
     * Gets a database recommended action.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain
     *                          this value from the Azure Resource Manager API or the portal.
     * @param serverName The name of the server.
     * @param databaseName The name of the database.
     * @param advisorName The name of the Database Advisor.
     * @param recommendedActionName The name of Database Recommended Action.
     * @param options The options parameters.
     */
    get(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, options) {
        return this.client.sendOperationRequest({
            resourceGroupName,
            serverName,
            databaseName,
            advisorName,
            recommendedActionName,
            options,
        }, getOperationSpec);
    }
    /**
     * Updates a database recommended action.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain
     *                          this value from the Azure Resource Manager API or the portal.
     * @param serverName The name of the server.
     * @param databaseName The name of the database.
     * @param advisorName The name of the Database Advisor.
     * @param recommendedActionName The name of Database Recommended Action.
     * @param parameters The requested recommended action resource state.
     * @param options The options parameters.
     */
    update(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, parameters, options) {
        return this.client.sendOperationRequest({
            resourceGroupName,
            serverName,
            databaseName,
            advisorName,
            recommendedActionName,
            parameters,
            options,
        }, updateOperationSpec);
    }
}
exports.DatabaseRecommendedActionsImpl = DatabaseRecommendedActionsImpl;
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listByDatabaseAdvisorOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}/recommendedActions",
    httpMethod: "GET",
    responses: {
        200: {
            bodyMapper: {
                type: {
                    name: "Sequence",
                    element: {
                        type: { name: "Composite", className: "RecommendedAction" },
                    },
                },
            },
        },
        default: {},
    },
    queryParameters: [Parameters.apiVersion3],
    urlParameters: [
        Parameters.$host,
        Parameters.subscriptionId,
        Parameters.resourceGroupName,
        Parameters.serverName,
        Parameters.databaseName,
        Parameters.advisorName,
    ],
    headerParameters: [Parameters.accept],
    serializer,
};
const getOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}/recommendedActions/{recommendedActionName}",
    httpMethod: "GET",
    responses: {
        200: {
            bodyMapper: Mappers.RecommendedAction,
        },
        default: {},
    },
    queryParameters: [Parameters.apiVersion3],
    urlParameters: [
        Parameters.$host,
        Parameters.subscriptionId,
        Parameters.resourceGroupName,
        Parameters.serverName,
        Parameters.databaseName,
        Parameters.advisorName,
        Parameters.recommendedActionName,
    ],
    headerParameters: [Parameters.accept],
    serializer,
};
const updateOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}/recommendedActions/{recommendedActionName}",
    httpMethod: "PATCH",
    responses: {
        200: {
            bodyMapper: Mappers.RecommendedAction,
        },
        default: {},
    },
    requestBody: Parameters.parameters13,
    queryParameters: [Parameters.apiVersion3],
    urlParameters: [
        Parameters.$host,
        Parameters.subscriptionId,
        Parameters.resourceGroupName,
        Parameters.serverName,
        Parameters.databaseName,
        Parameters.advisorName,
        Parameters.recommendedActionName,
    ],
    headerParameters: [Parameters.contentType, Parameters.accept],
    mediaType: "json",
    serializer,
};
//# sourceMappingURL=databaseRecommendedActions.js.map