"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ServerAdvisorsImpl = 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 ServerAdvisors operations. */
class ServerAdvisorsImpl {
    client;
    /**
     * Initialize a new instance of the class ServerAdvisors class.
     * @param client Reference to the service client
     */
    constructor(client) {
        this.client = client;
    }
    /**
     * Gets a list of server advisors.
     * @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 options The options parameters.
     */
    listByServer(resourceGroupName, serverName, options) {
        return this.client.sendOperationRequest({ resourceGroupName, serverName, options }, listByServerOperationSpec);
    }
    /**
     * Gets a server advisor.
     * @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 advisorName The name of the Server Advisor.
     * @param options The options parameters.
     */
    get(resourceGroupName, serverName, advisorName, options) {
        return this.client.sendOperationRequest({ resourceGroupName, serverName, advisorName, options }, getOperationSpec);
    }
    /**
     * Updates a server advisor.
     * @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 advisorName The name of the Server Advisor.
     * @param parameters The requested advisor resource state.
     * @param options The options parameters.
     */
    update(resourceGroupName, serverName, advisorName, parameters, options) {
        return this.client.sendOperationRequest({ resourceGroupName, serverName, advisorName, parameters, options }, updateOperationSpec);
    }
}
exports.ServerAdvisorsImpl = ServerAdvisorsImpl;
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listByServerOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/advisors",
    httpMethod: "GET",
    responses: {
        200: {
            bodyMapper: {
                type: {
                    name: "Sequence",
                    element: { type: { name: "Composite", className: "Advisor" } },
                },
            },
        },
        default: {},
    },
    queryParameters: [Parameters.expand, Parameters.apiVersion3],
    urlParameters: [
        Parameters.$host,
        Parameters.subscriptionId,
        Parameters.resourceGroupName,
        Parameters.serverName,
    ],
    headerParameters: [Parameters.accept],
    serializer,
};
const getOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/advisors/{advisorName}",
    httpMethod: "GET",
    responses: {
        200: {
            bodyMapper: Mappers.Advisor,
        },
        default: {},
    },
    queryParameters: [Parameters.apiVersion3],
    urlParameters: [
        Parameters.$host,
        Parameters.subscriptionId,
        Parameters.resourceGroupName,
        Parameters.serverName,
        Parameters.advisorName,
    ],
    headerParameters: [Parameters.accept],
    serializer,
};
const updateOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/advisors/{advisorName}",
    httpMethod: "PATCH",
    responses: {
        200: {
            bodyMapper: Mappers.Advisor,
        },
        default: {},
    },
    requestBody: Parameters.parameters11,
    queryParameters: [Parameters.apiVersion3],
    urlParameters: [
        Parameters.$host,
        Parameters.subscriptionId,
        Parameters.resourceGroupName,
        Parameters.serverName,
        Parameters.advisorName,
    ],
    headerParameters: [Parameters.contentType, Parameters.accept],
    mediaType: "json",
    serializer,
};
//# sourceMappingURL=serverAdvisors.js.map