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

import { APIResource } from '../../../core/resource';
import { PagePromise, SinglePage } from '../../../core/pagination';
import { RequestOptions } from '../../../internal/request-options';
import { path } from '../../../internal/utils/path';

export class BaseRegions extends APIResource {
  static override readonly _key: readonly ['addressing', 'regionalHostnames', 'regions'] = Object.freeze([
    'addressing',
    'regionalHostnames',
    'regions',
  ] as const);

  /**
   * List all Regional Services regions available for use by this account.
   *
   * @example
   * ```ts
   * // Automatically fetches more pages as needed.
   * for await (const regionListResponse of client.addressing.regionalHostnames.regions.list(
   *   { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
   * )) {
   *   // ...
   * }
   * ```
   */
  list(
    params: RegionListParams,
    options?: RequestOptions,
  ): PagePromise<RegionListResponsesSinglePage, RegionListResponse> {
    const { account_id } = params;
    return this._client.getAPIList(
      path`/accounts/${account_id}/addressing/regional_hostnames/regions`,
      SinglePage<RegionListResponse>,
      options,
    );
  }
}
export class Regions extends BaseRegions {}

export type RegionListResponsesSinglePage = SinglePage<RegionListResponse>;

export interface RegionListResponse {
  /**
   * Identifying key for the region
   */
  key?: string;

  /**
   * Human-readable text label for the region
   */
  label?: string;
}

export interface RegionListParams {
  /**
   * Identifier.
   */
  account_id: string;
}

export declare namespace Regions {
  export {
    type RegionListResponse as RegionListResponse,
    type RegionListResponsesSinglePage as RegionListResponsesSinglePage,
    type RegionListParams as RegionListParams,
  };
}
