/*
 * Copyright (c) Microsoft Corporation.
 * Licensed under the MIT License.
 *
 * Code generated by Microsoft (R) AutoRest Code Generator.
 * Changes may cause incorrect behavior and will be lost if the code is regenerated.
 */
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers.js";
import * as Parameters from "../models/parameters.js";
/** Class containing Indexers operations. */
export class IndexersImpl {
    client;
    /**
     * Initialize a new instance of the class Indexers class.
     * @param client Reference to the service client
     */
    constructor(client) {
        this.client = client;
    }
    /**
     * Resets the change tracking state associated with an indexer.
     * @param indexerName The name of the indexer to reset.
     * @param options The options parameters.
     */
    reset(indexerName, options) {
        return this.client.sendOperationRequest({ indexerName, options }, resetOperationSpec);
    }
    /**
     * Runs an indexer on-demand.
     * @param indexerName The name of the indexer to run.
     * @param options The options parameters.
     */
    run(indexerName, options) {
        return this.client.sendOperationRequest({ indexerName, options }, runOperationSpec);
    }
    /**
     * Creates a new indexer or updates an indexer if it already exists.
     * @param indexerName The name of the indexer to create or update.
     * @param indexer The definition of the indexer to create or update.
     * @param options The options parameters.
     */
    createOrUpdate(indexerName, indexer, options) {
        return this.client.sendOperationRequest({ indexerName, indexer, options }, createOrUpdateOperationSpec);
    }
    /**
     * Deletes an indexer.
     * @param indexerName The name of the indexer to delete.
     * @param options The options parameters.
     */
    delete(indexerName, options) {
        return this.client.sendOperationRequest({ indexerName, options }, deleteOperationSpec);
    }
    /**
     * Retrieves an indexer definition.
     * @param indexerName The name of the indexer to retrieve.
     * @param options The options parameters.
     */
    get(indexerName, options) {
        return this.client.sendOperationRequest({ indexerName, options }, getOperationSpec);
    }
    /**
     * Lists all indexers available for a search service.
     * @param options The options parameters.
     */
    list(options) {
        return this.client.sendOperationRequest({ options }, listOperationSpec);
    }
    /**
     * Creates a new indexer.
     * @param indexer The definition of the indexer to create.
     * @param options The options parameters.
     */
    create(indexer, options) {
        return this.client.sendOperationRequest({ indexer, options }, createOperationSpec);
    }
    /**
     * Returns the current status and execution history of an indexer.
     * @param indexerName The name of the indexer for which to retrieve status.
     * @param options The options parameters.
     */
    getStatus(indexerName, options) {
        return this.client.sendOperationRequest({ indexerName, options }, getStatusOperationSpec);
    }
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const resetOperationSpec = {
    path: "/indexers('{indexerName}')/search.reset",
    httpMethod: "POST",
    responses: {
        204: {},
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    queryParameters: [Parameters.apiVersion],
    urlParameters: [Parameters.endpoint, Parameters.indexerName],
    headerParameters: [Parameters.accept],
    serializer,
};
const runOperationSpec = {
    path: "/indexers('{indexerName}')/search.run",
    httpMethod: "POST",
    responses: {
        202: {},
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    queryParameters: [Parameters.apiVersion],
    urlParameters: [Parameters.endpoint, Parameters.indexerName],
    headerParameters: [Parameters.accept],
    serializer,
};
const createOrUpdateOperationSpec = {
    path: "/indexers('{indexerName}')",
    httpMethod: "PUT",
    responses: {
        200: {
            bodyMapper: Mappers.SearchIndexer,
        },
        201: {
            bodyMapper: Mappers.SearchIndexer,
        },
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    requestBody: Parameters.indexer,
    queryParameters: [Parameters.apiVersion],
    urlParameters: [Parameters.endpoint, Parameters.indexerName],
    headerParameters: [
        Parameters.contentType,
        Parameters.accept,
        Parameters.ifMatch,
        Parameters.ifNoneMatch,
        Parameters.prefer,
    ],
    mediaType: "json",
    serializer,
};
const deleteOperationSpec = {
    path: "/indexers('{indexerName}')",
    httpMethod: "DELETE",
    responses: {
        204: {},
        404: {},
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    queryParameters: [Parameters.apiVersion],
    urlParameters: [Parameters.endpoint, Parameters.indexerName],
    headerParameters: [
        Parameters.accept,
        Parameters.ifMatch,
        Parameters.ifNoneMatch,
    ],
    serializer,
};
const getOperationSpec = {
    path: "/indexers('{indexerName}')",
    httpMethod: "GET",
    responses: {
        200: {
            bodyMapper: Mappers.SearchIndexer,
        },
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    queryParameters: [Parameters.apiVersion],
    urlParameters: [Parameters.endpoint, Parameters.indexerName],
    headerParameters: [Parameters.accept],
    serializer,
};
const listOperationSpec = {
    path: "/indexers",
    httpMethod: "GET",
    responses: {
        200: {
            bodyMapper: Mappers.ListIndexersResult,
        },
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    queryParameters: [Parameters.apiVersion, Parameters.select],
    urlParameters: [Parameters.endpoint],
    headerParameters: [Parameters.accept],
    serializer,
};
const createOperationSpec = {
    path: "/indexers",
    httpMethod: "POST",
    responses: {
        201: {
            bodyMapper: Mappers.SearchIndexer,
        },
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    requestBody: Parameters.indexer,
    queryParameters: [Parameters.apiVersion],
    urlParameters: [Parameters.endpoint],
    headerParameters: [Parameters.contentType, Parameters.accept],
    mediaType: "json",
    serializer,
};
const getStatusOperationSpec = {
    path: "/indexers('{indexerName}')/search.status",
    httpMethod: "GET",
    responses: {
        200: {
            bodyMapper: Mappers.SearchIndexerStatus,
        },
        default: {
            bodyMapper: Mappers.ErrorResponse,
        },
    },
    queryParameters: [Parameters.apiVersion],
    urlParameters: [Parameters.endpoint, Parameters.indexerName],
    headerParameters: [Parameters.accept],
    serializer,
};
//# sourceMappingURL=indexers.js.map