// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { APIResource } from '../../core/resource';
import { APIPromise } from '../../core/api-promise';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';

export class BaseSettings extends APIResource {
  static override readonly _key: readonly ['networkInterconnects', 'settings'] = Object.freeze([
    'networkInterconnects',
    'settings',
  ] as const);

  /**
   * Updates configuration settings for the specified resource or service.
   *
   * @example
   * ```ts
   * const setting =
   *   await client.networkInterconnects.settings.update({
   *     account_id: 'account_id',
   *   });
   * ```
   */
  update(params: SettingUpdateParams, options?: RequestOptions): APIPromise<SettingUpdateResponse> {
    const { account_id, ...body } = params;
    return this._client.put(path`/accounts/${account_id}/cni/settings`, { body, ...options });
  }

  /**
   * Retrieves current settings configuration for the specified resource or service.
   *
   * @example
   * ```ts
   * const setting =
   *   await client.networkInterconnects.settings.get({
   *     account_id: 'account_id',
   *   });
   * ```
   */
  get(params: SettingGetParams, options?: RequestOptions): APIPromise<SettingGetResponse> {
    const { account_id } = params;
    return this._client.get(path`/accounts/${account_id}/cni/settings`, options);
  }
}
export class Settings extends BaseSettings {}

export interface SettingUpdateResponse {
  default_asn: number;
}

export interface SettingGetResponse {
  default_asn: number;
}

export interface SettingUpdateParams {
  /**
   * Path param: Account tag to update settings for
   */
  account_id: string;

  /**
   * Body param
   */
  default_asn?: number | null;
}

export interface SettingGetParams {
  /**
   * Account tag to retrieve settings for
   */
  account_id: string;
}

export declare namespace Settings {
  export {
    type SettingUpdateResponse as SettingUpdateResponse,
    type SettingGetResponse as SettingGetResponse,
    type SettingUpdateParams as SettingUpdateParams,
    type SettingGetParams as SettingGetParams,
  };
}
