/* 
  AUTOGENERATED FILE
  Run "npm run generateARMClients" to regenerate
  Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs

  Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/DocumentDB/preview/2025-11-01-preview/cosmos-db.json
*/

import { armRequest } from "../../request";
import * as Types from "./types";
import { configContext } from "../../../../ConfigContext";
const apiVersion = "2025-11-01-preview";

/* Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. */
export async function listCassandraKeyspaces(
  subscriptionId: string,
  resourceGroupName: string,
  accountName: string,
): Promise<Types.CassandraKeyspaceListResult> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion });
}

/* Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. */
export async function getCassandraKeyspace(
  subscriptionId: string,
  resourceGroupName: string,
  accountName: string,
  keyspaceName: string,
): Promise<Types.CassandraKeyspaceGetResults> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion });
}

/* Create or update an Azure Cosmos DB Cassandra keyspace */
export async function createUpdateCassandraKeyspace(
  subscriptionId: string,
  resourceGroupName: string,
  accountName: string,
  keyspaceName: string,
  body: Types.CassandraKeyspaceCreateUpdateParameters,
): Promise<Types.CassandraKeyspaceGetResults | void> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "PUT", apiVersion, body });
}

/* Deletes an existing Azure Cosmos DB Cassandra keyspace. */
export async function deleteCassandraKeyspace(
  subscriptionId: string,
  resourceGroupName: string,
  accountName: string,
  keyspaceName: string,
): Promise<void> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "DELETE", apiVersion });
}

/* Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the provided name. */
export async function getCassandraKeyspaceThroughput(
  subscriptionId: string,
  resourceGroupName: string,
  accountName: string,
  keyspaceName: string,
): Promise<Types.ThroughputSettingsGetResults> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/throughputSettings/default`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion });
}

/* Update RUs per second of an Azure Cosmos DB Cassandra Keyspace */
export async function updateCassandraKeyspaceThroughput(
  subscriptionId: string,
  resourceGroupName: string,
  accountName: string,
  keyspaceName: string,
  body: Types.ThroughputSettingsUpdateParameters,
): Promise<Types.ThroughputSettingsGetResults | void> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/throughputSettings/default`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "PUT", apiVersion, body });
}

/* Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale */
export async function migrateCassandraKeyspaceToAutoscale(
  subscriptionId: string,
  resourceGroupName: string,
  accountName: string,
  keyspaceName: string,
): Promise<Types.ThroughputSettingsGetResults | void | Types.CloudError> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/throughputSettings/default/migrateToAutoscale`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion });
}

/* Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput */
export async function migrateCassandraKeyspaceToManualThroughput(
  subscriptionId: string,
  resourceGroupName: string,
  accountName: string,
  keyspaceName: string,
): Promise<Types.ThroughputSettingsGetResults | void | Types.CloudError> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/throughputSettings/default/migrateToManualThroughput`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion });
}

/* Lists the Cassandra table under an existing Azure Cosmos DB database account. */
export async function listCassandraTables(
  subscriptionId: string,
  resourceGroupName: string,
  accountName: string,
  keyspaceName: string,
): Promise<Types.CassandraTableListResult> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion });
}

/* Gets the Cassandra table under an existing Azure Cosmos DB database account. */
export async function getCassandraTable(
  subscriptionId: string,
  resourceGroupName: string,
  accountName: string,
  keyspaceName: string,
  tableName: string,
): Promise<Types.CassandraTableGetResults> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion });
}

/* Create or update an Azure Cosmos DB Cassandra Table */
export async function createUpdateCassandraTable(
  subscriptionId: string,
  resourceGroupName: string,
  accountName: string,
  keyspaceName: string,
  tableName: string,
  body: Types.CassandraTableCreateUpdateParameters,
): Promise<Types.CassandraTableGetResults | void> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "PUT", apiVersion, body });
}

/* Deletes an existing Azure Cosmos DB Cassandra table. */
export async function deleteCassandraTable(
  subscriptionId: string,
  resourceGroupName: string,
  accountName: string,
  keyspaceName: string,
  tableName: string,
): Promise<void> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "DELETE", apiVersion });
}

/* Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. */
export async function getCassandraTableThroughput(
  subscriptionId: string,
  resourceGroupName: string,
  accountName: string,
  keyspaceName: string,
  tableName: string,
): Promise<Types.ThroughputSettingsGetResults> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}/throughputSettings/default`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion });
}

/* Update RUs per second of an Azure Cosmos DB Cassandra table */
export async function updateCassandraTableThroughput(
  subscriptionId: string,
  resourceGroupName: string,
  accountName: string,
  keyspaceName: string,
  tableName: string,
  body: Types.ThroughputSettingsUpdateParameters,
): Promise<Types.ThroughputSettingsGetResults | void> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}/throughputSettings/default`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "PUT", apiVersion, body });
}

/* Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale */
export async function migrateCassandraTableToAutoscale(
  subscriptionId: string,
  resourceGroupName: string,
  accountName: string,
  keyspaceName: string,
  tableName: string,
): Promise<Types.ThroughputSettingsGetResults | void | Types.CloudError> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}/throughputSettings/default/migrateToAutoscale`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion });
}

/* Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput */
export async function migrateCassandraTableToManualThroughput(
  subscriptionId: string,
  resourceGroupName: string,
  accountName: string,
  keyspaceName: string,
  tableName: string,
): Promise<Types.ThroughputSettingsGetResults | void | Types.CloudError> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}/throughputSettings/default/migrateToManualThroughput`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion });
}

/* Lists the Cassandra materialized views under an existing Azure Cosmos DB database account. */
export async function listCassandraViews(
  subscriptionId: string,
  resourceGroupName: string,
  accountName: string,
  keyspaceName: string,
): Promise<Types.CassandraViewListResult> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/views`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion });
}

/* Gets the Cassandra view under an existing Azure Cosmos DB database account. */
export async function getCassandraView(
  subscriptionId: string,
  resourceGroupName: string,
  accountName: string,
  keyspaceName: string,
  viewName: string,
): Promise<Types.CassandraViewGetResults> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/views/${viewName}`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion });
}

/* Create or update an Azure Cosmos DB Cassandra View */
export async function createUpdateCassandraView(
  subscriptionId: string,
  resourceGroupName: string,
  accountName: string,
  keyspaceName: string,
  viewName: string,
  body: Types.CassandraViewCreateUpdateParameters,
): Promise<Types.CassandraViewGetResults | void> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/views/${viewName}`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "PUT", apiVersion, body });
}

/* Deletes an existing Azure Cosmos DB Cassandra view. */
export async function deleteCassandraView(
  subscriptionId: string,
  resourceGroupName: string,
  accountName: string,
  keyspaceName: string,
  viewName: string,
): Promise<void> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/views/${viewName}`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "DELETE", apiVersion });
}

/* Gets the RUs per second of the Cassandra view under an existing Azure Cosmos DB database account with the provided name. */
export async function getCassandraViewThroughput(
  subscriptionId: string,
  resourceGroupName: string,
  accountName: string,
  keyspaceName: string,
  viewName: string,
): Promise<Types.ThroughputSettingsGetResults> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/views/${viewName}/throughputSettings/default`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion });
}

/* Update RUs per second of an Azure Cosmos DB Cassandra view */
export async function updateCassandraViewThroughput(
  subscriptionId: string,
  resourceGroupName: string,
  accountName: string,
  keyspaceName: string,
  viewName: string,
  body: Types.ThroughputSettingsUpdateParameters,
): Promise<Types.ThroughputSettingsGetResults | void> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/views/${viewName}/throughputSettings/default`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "PUT", apiVersion, body });
}

/* Migrate an Azure Cosmos DB Cassandra view from manual throughput to autoscale */
export async function migrateCassandraViewToAutoscale(
  subscriptionId: string,
  resourceGroupName: string,
  accountName: string,
  keyspaceName: string,
  viewName: string,
): Promise<Types.ThroughputSettingsGetResults | void | Types.CloudError> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/views/${viewName}/throughputSettings/default/migrateToAutoscale`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion });
}

/* Migrate an Azure Cosmos DB Cassandra view from autoscale to manual throughput */
export async function migrateCassandraViewToManualThroughput(
  subscriptionId: string,
  resourceGroupName: string,
  accountName: string,
  keyspaceName: string,
  viewName: string,
): Promise<Types.ThroughputSettingsGetResults | void | Types.CloudError> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/views/${viewName}/throughputSettings/default/migrateToManualThroughput`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion });
}
