// 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 BaseQuota extends APIResource {
  static override readonly _key: readonly ['zeroTrust', 'dex', 'commands', 'quota'] = Object.freeze([
    'zeroTrust',
    'dex',
    'commands',
    'quota',
  ] as const);

  /**
   * Retrieves the current quota usage and limits for device commands within a
   * specific account, including the time when the quota will reset
   *
   * @example
   * ```ts
   * const quota = await client.zeroTrust.dex.commands.quota.get(
   *   { account_id: '01a7362d577a6c3019a474fd6f485823' },
   * );
   * ```
   */
  get(params: QuotaGetParams, options?: RequestOptions): APIPromise<QuotaGetResponse> {
    const { account_id } = params;
    return (
      this._client.get(path`/accounts/${account_id}/dex/commands/quota`, options) as APIPromise<{
        result: QuotaGetResponse;
      }>
    )._thenUnwrap((obj) => obj.result);
  }
}
export class Quota extends BaseQuota {}

export interface QuotaGetResponse {
  /**
   * The total number of commands that can be initiated for an account.
   */
  quota: number;

  /**
   * The number of commands that have been initiated for an account.
   */
  quota_usage: number;

  /**
   * The time when the quota resets.
   */
  reset_time: string;
}

export interface QuotaGetParams {
  /**
   * Unique Cloudflare account ID.
   */
  account_id: string;
}

export declare namespace Quota {
  export { type QuotaGetResponse as QuotaGetResponse, type QuotaGetParams as QuotaGetParams };
}
