// Code generated by Fern. DO NOT EDIT.

package templates

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,
			},
		),
	}
}

func (c *Client) GetUniversalLogin(
	ctx context.Context,
	opts ...option.RequestOption,
) (*management.GetUniversalLoginTemplateResponseContent, error) {
	response, err := c.WithRawResponse.GetUniversalLogin(
		ctx,
		opts...,
	)
	if err != nil {
		return nil, err
	}
	return response.Body, nil
}

// Update the Universal Login branding template.
//
// <p>When <code>content-type</code> header is set to <code>application/json</code>:</p>
// <pre>
//
//	{
//	  "template": "&lt;!DOCTYPE html&gt;{% assign resolved_dir = dir | default: "auto" %}&lt;html lang="{{locale}}" dir="{{resolved_dir}}"&gt;&lt;head&gt;{%- auth0:head -%}&lt;/head&gt;&lt;body class="_widget-auto-layout"&gt;{%- auth0:widget -%}&lt;/body&gt;&lt;/html&gt;"
//	}
//
// </pre>
//
// <p>
//
//	When <code>content-type</code> header is set to <code>text/html</code>:
//
// </p>
// <pre>
// &lt!DOCTYPE html&gt;
// {% assign resolved_dir = dir | default: "auto" %}
// &lt;html lang="{{locale}}" dir="{{resolved_dir}}"&gt;
//
//	&lt;head&gt;
//	  {%- auth0:head -%}
//	&lt;/head&gt;
//	&lt;body class="_widget-auto-layout"&gt;
//	  {%- auth0:widget -%}
//	&lt;/body&gt;
//
// &lt;/html&gt;
// </pre>
func (c *Client) UpdateUniversalLogin(
	ctx context.Context,
	request *management.UpdateUniversalLoginTemplateRequestContent,
	opts ...option.RequestOption,
) error {
	_, err := c.WithRawResponse.UpdateUniversalLogin(
		ctx,
		request,
		opts...,
	)
	if err != nil {
		return err
	}
	return nil
}

func (c *Client) DeleteUniversalLogin(
	ctx context.Context,
	opts ...option.RequestOption,
) error {
	_, err := c.WithRawResponse.DeleteUniversalLogin(
		ctx,
		opts...,
	)
	if err != nil {
		return err
	}
	return nil
}
