/*
 * 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 { App } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { AppCenterClient } from "../appCenterClient";
import { AppBlockLogsOptionalParams, AppBlockLogsResponse } from "../models";

/** Class containing App operations. */
export class AppImpl implements App {
  private readonly client: AppCenterClient;

  /**
   * Initialize a new instance of the class App class.
   * @param client Reference to the service client
   */
  constructor(client: AppCenterClient) {
    this.client = client;
  }

  /**
   * **Warning, this operation is not reversible.**
   *
   * A successful call to this API will permanently stop ingesting any logs received via SDK by app_id,
   * and cannot be restored. We advise caution when using this API, it is designed to permanently disable
   * an app_id.
   *
   * @param ownerName The name of the owner
   * @param appName The name of the application
   * @param options The options parameters.
   */
  blockLogs(
    ownerName: string,
    appName: string,
    options?: AppBlockLogsOptionalParams
  ): Promise<AppBlockLogsResponse> {
    return this.client.sendOperationRequest(
      { ownerName, appName, options },
      blockLogsOperationSpec
    );
  }
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);

const blockLogsOperationSpec: coreClient.OperationSpec = {
  path: "/v0.1/apps/{owner_name}/{app_name}/devices/block_logs",
  httpMethod: "PUT",
  responses: {
    200: {
      bodyMapper: { type: { name: "String" } }
    }
  },
  urlParameters: [Parameters.$host, Parameters.ownerName, Parameters.appName],
  headerParameters: [Parameters.accept],
  serializer
};
