// Code generated by Fern. DO NOT EDIT.

package sms

import (
	context "context"
	management "github.com/auth0/go-auth0/v2/management"
	core "github.com/auth0/go-auth0/v2/management/core"
	internal "github.com/auth0/go-auth0/v2/management/internal"
	option "github.com/auth0/go-auth0/v2/management/option"
)

type Client struct {
	WithRawResponse *RawClient

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

func NewClient(options *core.RequestOptions) *Client {
	return &Client{
		WithRawResponse: NewRawClient(options),
		options:         options,
		baseURL:         options.BaseURL,
		caller: internal.NewCaller(
			&internal.CallerParams{
				Client:      options.HTTPClient,
				MaxAttempts: options.MaxAttempts,
			},
		),
	}
}

// Retrieve the <a href="https://auth0.com/docs/multifactor-authentication/twilio-configuration">Twilio SMS provider configuration</a> (subscription required).
//
//	A new endpoint is available to retrieve the Twilio configuration related to phone factors (<a href='https://auth0.com/docs/api/management/v2/#!/Guardian/get_twilio'>phone Twilio configuration</a>). It has the same payload as this one. Please use it instead.
func (c *Client) GetTwilioProvider(
	ctx context.Context,
	opts ...option.RequestOption,
) (*management.GetGuardianFactorsProviderSmsTwilioResponseContent, error) {
	response, err := c.WithRawResponse.GetTwilioProvider(
		ctx,
		opts...,
	)
	if err != nil {
		return nil, err
	}
	return response.Body, nil
}

// This endpoint has been deprecated. To complete this action, use the <a href="https://auth0.com/docs/api/management/v2/guardian/put-twilio">Update Twilio phone configuration</a> endpoint.
//
//	<b>Previous functionality</b>: Update the Twilio SMS provider configuration.
func (c *Client) SetTwilioProvider(
	ctx context.Context,
	request *management.SetGuardianFactorsProviderSmsTwilioRequestContent,
	opts ...option.RequestOption,
) (*management.SetGuardianFactorsProviderSmsTwilioResponseContent, error) {
	response, err := c.WithRawResponse.SetTwilioProvider(
		ctx,
		request,
		opts...,
	)
	if err != nil {
		return nil, err
	}
	return response.Body, nil
}

// This endpoint has been deprecated. To complete this action, use the <a href="https://auth0.com/docs/api/management/v2/guardian/get-phone-providers">Retrieve phone configuration</a> endpoint instead.
//
//	<b>Previous functionality</b>: Retrieve details for the multi-factor authentication SMS provider configured for your tenant.
func (c *Client) GetSelectedProvider(
	ctx context.Context,
	opts ...option.RequestOption,
) (*management.GetGuardianFactorsProviderSmsResponseContent, error) {
	response, err := c.WithRawResponse.GetSelectedProvider(
		ctx,
		opts...,
	)
	if err != nil {
		return nil, err
	}
	return response.Body, nil
}

// This endpoint has been deprecated. To complete this action, use the <a href="https://auth0.com/docs/api/management/v2/guardian/put-phone-providers">Update phone configuration</a> endpoint instead.
//
//	<b>Previous functionality</b>: Update the multi-factor authentication SMS provider configuration in your tenant.
func (c *Client) SetProvider(
	ctx context.Context,
	request *management.SetGuardianFactorsProviderSmsRequestContent,
	opts ...option.RequestOption,
) (*management.SetGuardianFactorsProviderSmsResponseContent, error) {
	response, err := c.WithRawResponse.SetProvider(
		ctx,
		request,
		opts...,
	)
	if err != nil {
		return nil, err
	}
	return response.Body, nil
}

// This endpoint has been deprecated. To complete this action, use the <a href="https://auth0.com/docs/api/management/v2/guardian/get-factor-phone-templates">Retrieve enrollment and verification phone templates</a> endpoint instead.
//
//	<b>Previous function</b>: Retrieve details of SMS enrollment and verification templates configured for your tenant.
func (c *Client) GetTemplates(
	ctx context.Context,
	opts ...option.RequestOption,
) (*management.GetGuardianFactorSmsTemplatesResponseContent, error) {
	response, err := c.WithRawResponse.GetTemplates(
		ctx,
		opts...,
	)
	if err != nil {
		return nil, err
	}
	return response.Body, nil
}

// This endpoint has been deprecated. To complete this action, use the <a href="https://auth0.com/docs/api/management/v2/guardian/put-factor-phone-templates">Update enrollment and verification phone templates</a> endpoint instead.
//
//	<b>Previous functionality</b>: Customize the messages sent to complete SMS enrollment and verification.
func (c *Client) SetTemplates(
	ctx context.Context,
	request *management.SetGuardianFactorSmsTemplatesRequestContent,
	opts ...option.RequestOption,
) (*management.SetGuardianFactorSmsTemplatesResponseContent, error) {
	response, err := c.WithRawResponse.SetTemplates(
		ctx,
		request,
		opts...,
	)
	if err != nil {
		return nil, err
	}
	return response.Body, nil
}
