import * as Models from "./models";


/**
 * API endpoints for TOTP Setup.
 */
export class TotpSetup {
  private client: any;

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

  /**
   * Start 2FA setup process. Creates a new TOTP device and returns QR code
   * for scanning.
   */
  async create(data: Models.SetupRequest): Promise<Models.SetupResponse> {
    const response = await this.client.request('POST', "/cfg/totp/setup/", { body: data });
    return response;
  }

  /**
   * Confirm 2FA setup with first valid code. Activates the device and
   * generates backup codes.
   */
  async confirmCreate(data: Models.ConfirmSetupRequest): Promise<Models.ConfirmSetupResponse> {
    const response = await this.client.request('POST', "/cfg/totp/setup/confirm/", { body: data });
    return response;
  }

}