// Auto-generated by DjangoCFG - see CLAUDE.md
'use client';

/**
 * SWR Hooks for TOTP Setup
 *
 * React hooks powered by SWR for data fetching with automatic caching,
 * revalidation, and optimistic updates.
 *
 * Usage:
 * ```typescript
 * // Query hooks (GET)
 * const { data, error, isLoading } = useUsers({ page: 1 })
 *
 * // Mutation hooks (POST/PUT/PATCH/DELETE)
 * const createUser = useCreateUser()
 * await createUser({ name: 'John', email: 'john@example.com' })
 * ```
 */
import { useSWRConfig } from 'swr'
import * as Fetchers from '../fetchers/totp__totp_setup'
import type { API } from '../../index'
import type { ConfirmSetupRequest } from '../schemas/ConfirmSetupRequest.schema'
import type { ConfirmSetupResponse } from '../schemas/ConfirmSetupResponse.schema'
import type { SetupRequest } from '../schemas/SetupRequest.schema'
import type { SetupResponse } from '../schemas/SetupResponse.schema'

/**
 * API operation
 *
 * @method POST
 * @path /cfg/totp/setup/
 */
export function useCreateTotpSetupCreate() {
  const { mutate } = useSWRConfig()

  return async (data: SetupRequest, client?: API): Promise<SetupResponse> => {
    const result = await Fetchers.createTotpSetupCreate(data, client)
    // Revalidate related queries
    mutate('cfg-totp-setup')
    return result
  }
}


/**
 * API operation
 *
 * @method POST
 * @path /cfg/totp/setup/confirm/
 */
export function useCreateTotpSetupConfirmCreate() {
  const { mutate } = useSWRConfig()

  return async (data: ConfirmSetupRequest, client?: API): Promise<ConfirmSetupResponse> => {
    const result = await Fetchers.createTotpSetupConfirmCreate(data, client)
    // Revalidate related queries
    mutate('cfg-totp-setup-confirm')
    return result
  }
}


