// Code generated by Fern. DO NOT EDIT.

package client

import (
	context "context"
	management "github.com/auth0/go-auth0/v2/management"
	core "github.com/auth0/go-auth0/v2/management/core"
	client "github.com/auth0/go-auth0/v2/management/guardian/factors/duo/client"
	phone "github.com/auth0/go-auth0/v2/management/guardian/factors/phone"
	pushnotification "github.com/auth0/go-auth0/v2/management/guardian/factors/pushnotification"
	sms "github.com/auth0/go-auth0/v2/management/guardian/factors/sms"
	internal "github.com/auth0/go-auth0/v2/management/internal"
	option "github.com/auth0/go-auth0/v2/management/option"
)

type Client struct {
	WithRawResponse  *RawClient
	Phone            *phone.Client
	PushNotification *pushnotification.Client
	Sms              *sms.Client
	Duo              *client.Client

	options *core.RequestOptions
	baseURL string
	caller  *internal.Caller
}

func NewClient(options *core.RequestOptions) *Client {
	return &Client{
		Phone:            phone.NewClient(options),
		PushNotification: pushnotification.NewClient(options),
		Sms:              sms.NewClient(options),
		Duo:              client.NewClient(options),
		WithRawResponse:  NewRawClient(options),
		options:          options,
		baseURL:          options.BaseURL,
		caller: internal.NewCaller(
			&internal.CallerParams{
				Client:      options.HTTPClient,
				MaxAttempts: options.MaxAttempts,
			},
		),
	}
}

// Retrieve details of all <a href="https://auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors">multi-factor authentication factors</a> associated with your tenant.
func (c *Client) List(
	ctx context.Context,
	opts ...option.RequestOption,
) ([]*management.GuardianFactor, error) {
	response, err := c.WithRawResponse.List(
		ctx,
		opts...,
	)
	if err != nil {
		return nil, err
	}
	return response.Body, nil
}

// Update the status (i.e., enabled or disabled) of a specific multi-factor authentication factor.
func (c *Client) Set(
	ctx context.Context,
	// Factor name. Can be `sms`, `push-notification`, `email`, `duo` `otp` `webauthn-roaming`, `webauthn-platform`, or `recovery-code`.
	name *management.GuardianFactorNameEnum,
	request *management.SetGuardianFactorRequestContent,
	opts ...option.RequestOption,
) (*management.SetGuardianFactorResponseContent, error) {
	response, err := c.WithRawResponse.Set(
		ctx,
		name,
		request,
		opts...,
	)
	if err != nil {
		return nil, err
	}
	return response.Body, nil
}
