import * as Models from "./models";


/**
 * API endpoints for TOTP Management.
 */
export class TotpManagement {
  private client: any;

  constructor(client: any) {
    this.client = client;
  }

  async totpDevicesList(ordering?: string, page?: number, page_size?: number, search?: string): Promise<Models.PaginatedDeviceListResponseList>;
  async totpDevicesList(params?: { ordering?: string; page?: number; page_size?: number; search?: string }): Promise<Models.PaginatedDeviceListResponseList>;

  /**
   * List all TOTP devices for user.
   */
  async totpDevicesList(...args: any[]): Promise<Models.PaginatedDeviceListResponseList> {
    const isParamsObject = args.length === 1 && typeof args[0] === 'object' && args[0] !== null && !Array.isArray(args[0]);
    
    let params;
    if (isParamsObject) {
      params = args[0];
    } else {
      params = { ordering: args[0], page: args[1], page_size: args[2], search: args[3] };
    }
    const response = await this.client.request('GET', "/cfg/totp/devices/", { params });
    return response;
  }

  /**
   * Completely disable 2FA for account. Requires verification code.
   */
  async totpDisableCreate(data: Models.DisableRequest): Promise<any> {
    const response = await this.client.request('POST', "/cfg/totp/disable/", { body: data });
    return response;
  }

}