// Code generated by Fern. DO NOT EDIT.

package management

import (
	json "encoding/json"
	fmt "fmt"
	internal "github.com/auth0/go-auth0/v2/management/internal"
	big "math/big"
)

var (
	createEmailTemplateResponseContentFieldTemplate               = big.NewInt(1 << 0)
	createEmailTemplateResponseContentFieldBody                   = big.NewInt(1 << 1)
	createEmailTemplateResponseContentFieldFrom                   = big.NewInt(1 << 2)
	createEmailTemplateResponseContentFieldResultURL              = big.NewInt(1 << 3)
	createEmailTemplateResponseContentFieldSubject                = big.NewInt(1 << 4)
	createEmailTemplateResponseContentFieldSyntax                 = big.NewInt(1 << 5)
	createEmailTemplateResponseContentFieldURLLifetimeInSeconds   = big.NewInt(1 << 6)
	createEmailTemplateResponseContentFieldIncludeEmailInRedirect = big.NewInt(1 << 7)
	createEmailTemplateResponseContentFieldEnabled                = big.NewInt(1 << 8)
)

type CreateEmailTemplateResponseContent struct {
	Template EmailTemplateNameEnum `json:"template" url:"template"`
	// Body of the email template.
	Body *string `json:"body,omitempty" url:"body,omitempty"`
	// Senders `from` email address.
	From *string `json:"from,omitempty" url:"from,omitempty"`
	// URL to redirect the user to after a successful action.
	ResultURL *string `json:"resultUrl,omitempty" url:"resultUrl,omitempty"`
	// Subject line of the email.
	Subject *string `json:"subject,omitempty" url:"subject,omitempty"`
	// Syntax of the template body.
	Syntax *string `json:"syntax,omitempty" url:"syntax,omitempty"`
	// Lifetime in seconds that the link within the email will be valid for.
	URLLifetimeInSeconds *float64 `json:"urlLifetimeInSeconds,omitempty" url:"urlLifetimeInSeconds,omitempty"`
	// Whether the `reset_email` and `verify_email` templates should include the user's email address as the `email` parameter in the returnUrl (true) or whether no email address should be included in the redirect (false). Defaults to true.
	IncludeEmailInRedirect *bool `json:"includeEmailInRedirect,omitempty" url:"includeEmailInRedirect,omitempty"`
	// Whether the template is enabled (true) or disabled (false).
	Enabled *bool `json:"enabled,omitempty" url:"enabled,omitempty"`

	// Private bitmask of fields set to an explicit value and therefore not to be omitted
	explicitFields *big.Int `json:"-" url:"-"`

	extraProperties map[string]interface{}
	rawJSON         json.RawMessage
}

func (c *CreateEmailTemplateResponseContent) GetTemplate() EmailTemplateNameEnum {
	if c == nil {
		return ""
	}
	return c.Template
}

func (c *CreateEmailTemplateResponseContent) GetBody() string {
	if c == nil || c.Body == nil {
		return ""
	}
	return *c.Body
}

func (c *CreateEmailTemplateResponseContent) GetFrom() string {
	if c == nil || c.From == nil {
		return ""
	}
	return *c.From
}

func (c *CreateEmailTemplateResponseContent) GetResultURL() string {
	if c == nil || c.ResultURL == nil {
		return ""
	}
	return *c.ResultURL
}

func (c *CreateEmailTemplateResponseContent) GetSubject() string {
	if c == nil || c.Subject == nil {
		return ""
	}
	return *c.Subject
}

func (c *CreateEmailTemplateResponseContent) GetSyntax() string {
	if c == nil || c.Syntax == nil {
		return ""
	}
	return *c.Syntax
}

func (c *CreateEmailTemplateResponseContent) GetURLLifetimeInSeconds() float64 {
	if c == nil || c.URLLifetimeInSeconds == nil {
		return 0
	}
	return *c.URLLifetimeInSeconds
}

func (c *CreateEmailTemplateResponseContent) GetIncludeEmailInRedirect() bool {
	if c == nil || c.IncludeEmailInRedirect == nil {
		return false
	}
	return *c.IncludeEmailInRedirect
}

func (c *CreateEmailTemplateResponseContent) GetEnabled() bool {
	if c == nil || c.Enabled == nil {
		return false
	}
	return *c.Enabled
}

func (c *CreateEmailTemplateResponseContent) GetExtraProperties() map[string]interface{} {
	return c.extraProperties
}

func (c *CreateEmailTemplateResponseContent) require(field *big.Int) {
	if c.explicitFields == nil {
		c.explicitFields = big.NewInt(0)
	}
	c.explicitFields.Or(c.explicitFields, field)
}

// SetTemplate sets the Template field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateEmailTemplateResponseContent) SetTemplate(template EmailTemplateNameEnum) {
	c.Template = template
	c.require(createEmailTemplateResponseContentFieldTemplate)
}

// SetBody sets the Body field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateEmailTemplateResponseContent) SetBody(body *string) {
	c.Body = body
	c.require(createEmailTemplateResponseContentFieldBody)
}

// SetFrom sets the From field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateEmailTemplateResponseContent) SetFrom(from *string) {
	c.From = from
	c.require(createEmailTemplateResponseContentFieldFrom)
}

// SetResultURL sets the ResultURL field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateEmailTemplateResponseContent) SetResultURL(resultURL *string) {
	c.ResultURL = resultURL
	c.require(createEmailTemplateResponseContentFieldResultURL)
}

// SetSubject sets the Subject field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateEmailTemplateResponseContent) SetSubject(subject *string) {
	c.Subject = subject
	c.require(createEmailTemplateResponseContentFieldSubject)
}

// SetSyntax sets the Syntax field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateEmailTemplateResponseContent) SetSyntax(syntax *string) {
	c.Syntax = syntax
	c.require(createEmailTemplateResponseContentFieldSyntax)
}

// SetURLLifetimeInSeconds sets the URLLifetimeInSeconds field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateEmailTemplateResponseContent) SetURLLifetimeInSeconds(urlLifetimeInSeconds *float64) {
	c.URLLifetimeInSeconds = urlLifetimeInSeconds
	c.require(createEmailTemplateResponseContentFieldURLLifetimeInSeconds)
}

// SetIncludeEmailInRedirect sets the IncludeEmailInRedirect field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateEmailTemplateResponseContent) SetIncludeEmailInRedirect(includeEmailInRedirect *bool) {
	c.IncludeEmailInRedirect = includeEmailInRedirect
	c.require(createEmailTemplateResponseContentFieldIncludeEmailInRedirect)
}

// SetEnabled sets the Enabled field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateEmailTemplateResponseContent) SetEnabled(enabled *bool) {
	c.Enabled = enabled
	c.require(createEmailTemplateResponseContentFieldEnabled)
}

func (c *CreateEmailTemplateResponseContent) UnmarshalJSON(data []byte) error {
	type unmarshaler CreateEmailTemplateResponseContent
	var value unmarshaler
	if err := json.Unmarshal(data, &value); err != nil {
		return err
	}
	*c = CreateEmailTemplateResponseContent(value)
	extraProperties, err := internal.ExtractExtraProperties(data, *c)
	if err != nil {
		return err
	}
	c.extraProperties = extraProperties
	c.rawJSON = json.RawMessage(data)
	return nil
}

func (c *CreateEmailTemplateResponseContent) MarshalJSON() ([]byte, error) {
	type embed CreateEmailTemplateResponseContent
	var marshaler = struct {
		embed
	}{
		embed: embed(*c),
	}
	explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields)
	return json.Marshal(explicitMarshaler)
}

func (c *CreateEmailTemplateResponseContent) String() string {
	if len(c.rawJSON) > 0 {
		if value, err := internal.StringifyJSON(c.rawJSON); err == nil {
			return value
		}
	}
	if value, err := internal.StringifyJSON(c); err == nil {
		return value
	}
	return fmt.Sprintf("%#v", c)
}

// Template name. Can be `verify_email`, `verify_email_by_code`, `reset_email`, `reset_email_by_code`, `welcome_email`, `blocked_account`, `stolen_credentials`, `enrollment_email`, `mfa_oob_code`, `user_invitation`, `async_approval`, `change_password` (legacy), or `password_reset` (legacy).
type EmailTemplateNameEnum string

const (
	EmailTemplateNameEnumVerifyEmail       EmailTemplateNameEnum = "verify_email"
	EmailTemplateNameEnumVerifyEmailByCode EmailTemplateNameEnum = "verify_email_by_code"
	EmailTemplateNameEnumResetEmail        EmailTemplateNameEnum = "reset_email"
	EmailTemplateNameEnumResetEmailByCode  EmailTemplateNameEnum = "reset_email_by_code"
	EmailTemplateNameEnumWelcomeEmail      EmailTemplateNameEnum = "welcome_email"
	EmailTemplateNameEnumBlockedAccount    EmailTemplateNameEnum = "blocked_account"
	EmailTemplateNameEnumStolenCredentials EmailTemplateNameEnum = "stolen_credentials"
	EmailTemplateNameEnumEnrollmentEmail   EmailTemplateNameEnum = "enrollment_email"
	EmailTemplateNameEnumMfaOobCode        EmailTemplateNameEnum = "mfa_oob_code"
	EmailTemplateNameEnumUserInvitation    EmailTemplateNameEnum = "user_invitation"
	EmailTemplateNameEnumChangePassword    EmailTemplateNameEnum = "change_password"
	EmailTemplateNameEnumPasswordReset     EmailTemplateNameEnum = "password_reset"
	EmailTemplateNameEnumAsyncApproval     EmailTemplateNameEnum = "async_approval"
)

func NewEmailTemplateNameEnumFromString(s string) (EmailTemplateNameEnum, error) {
	switch s {
	case "verify_email":
		return EmailTemplateNameEnumVerifyEmail, nil
	case "verify_email_by_code":
		return EmailTemplateNameEnumVerifyEmailByCode, nil
	case "reset_email":
		return EmailTemplateNameEnumResetEmail, nil
	case "reset_email_by_code":
		return EmailTemplateNameEnumResetEmailByCode, nil
	case "welcome_email":
		return EmailTemplateNameEnumWelcomeEmail, nil
	case "blocked_account":
		return EmailTemplateNameEnumBlockedAccount, nil
	case "stolen_credentials":
		return EmailTemplateNameEnumStolenCredentials, nil
	case "enrollment_email":
		return EmailTemplateNameEnumEnrollmentEmail, nil
	case "mfa_oob_code":
		return EmailTemplateNameEnumMfaOobCode, nil
	case "user_invitation":
		return EmailTemplateNameEnumUserInvitation, nil
	case "change_password":
		return EmailTemplateNameEnumChangePassword, nil
	case "password_reset":
		return EmailTemplateNameEnumPasswordReset, nil
	case "async_approval":
		return EmailTemplateNameEnumAsyncApproval, nil
	}
	var t EmailTemplateNameEnum
	return "", fmt.Errorf("%s is not a valid %T", s, t)
}

func (e EmailTemplateNameEnum) Ptr() *EmailTemplateNameEnum {
	return &e
}

var (
	getEmailTemplateResponseContentFieldTemplate               = big.NewInt(1 << 0)
	getEmailTemplateResponseContentFieldBody                   = big.NewInt(1 << 1)
	getEmailTemplateResponseContentFieldFrom                   = big.NewInt(1 << 2)
	getEmailTemplateResponseContentFieldResultURL              = big.NewInt(1 << 3)
	getEmailTemplateResponseContentFieldSubject                = big.NewInt(1 << 4)
	getEmailTemplateResponseContentFieldSyntax                 = big.NewInt(1 << 5)
	getEmailTemplateResponseContentFieldURLLifetimeInSeconds   = big.NewInt(1 << 6)
	getEmailTemplateResponseContentFieldIncludeEmailInRedirect = big.NewInt(1 << 7)
	getEmailTemplateResponseContentFieldEnabled                = big.NewInt(1 << 8)
)

type GetEmailTemplateResponseContent struct {
	Template *EmailTemplateNameEnum `json:"template,omitempty" url:"template,omitempty"`
	// Body of the email template.
	Body *string `json:"body,omitempty" url:"body,omitempty"`
	// Senders `from` email address.
	From *string `json:"from,omitempty" url:"from,omitempty"`
	// URL to redirect the user to after a successful action.
	ResultURL *string `json:"resultUrl,omitempty" url:"resultUrl,omitempty"`
	// Subject line of the email.
	Subject *string `json:"subject,omitempty" url:"subject,omitempty"`
	// Syntax of the template body.
	Syntax *string `json:"syntax,omitempty" url:"syntax,omitempty"`
	// Lifetime in seconds that the link within the email will be valid for.
	URLLifetimeInSeconds *float64 `json:"urlLifetimeInSeconds,omitempty" url:"urlLifetimeInSeconds,omitempty"`
	// Whether the `reset_email` and `verify_email` templates should include the user's email address as the `email` parameter in the returnUrl (true) or whether no email address should be included in the redirect (false). Defaults to true.
	IncludeEmailInRedirect *bool `json:"includeEmailInRedirect,omitempty" url:"includeEmailInRedirect,omitempty"`
	// Whether the template is enabled (true) or disabled (false).
	Enabled *bool `json:"enabled,omitempty" url:"enabled,omitempty"`

	// Private bitmask of fields set to an explicit value and therefore not to be omitted
	explicitFields *big.Int `json:"-" url:"-"`

	extraProperties map[string]interface{}
	rawJSON         json.RawMessage
}

func (g *GetEmailTemplateResponseContent) GetTemplate() EmailTemplateNameEnum {
	if g == nil || g.Template == nil {
		return ""
	}
	return *g.Template
}

func (g *GetEmailTemplateResponseContent) GetBody() string {
	if g == nil || g.Body == nil {
		return ""
	}
	return *g.Body
}

func (g *GetEmailTemplateResponseContent) GetFrom() string {
	if g == nil || g.From == nil {
		return ""
	}
	return *g.From
}

func (g *GetEmailTemplateResponseContent) GetResultURL() string {
	if g == nil || g.ResultURL == nil {
		return ""
	}
	return *g.ResultURL
}

func (g *GetEmailTemplateResponseContent) GetSubject() string {
	if g == nil || g.Subject == nil {
		return ""
	}
	return *g.Subject
}

func (g *GetEmailTemplateResponseContent) GetSyntax() string {
	if g == nil || g.Syntax == nil {
		return ""
	}
	return *g.Syntax
}

func (g *GetEmailTemplateResponseContent) GetURLLifetimeInSeconds() float64 {
	if g == nil || g.URLLifetimeInSeconds == nil {
		return 0
	}
	return *g.URLLifetimeInSeconds
}

func (g *GetEmailTemplateResponseContent) GetIncludeEmailInRedirect() bool {
	if g == nil || g.IncludeEmailInRedirect == nil {
		return false
	}
	return *g.IncludeEmailInRedirect
}

func (g *GetEmailTemplateResponseContent) GetEnabled() bool {
	if g == nil || g.Enabled == nil {
		return false
	}
	return *g.Enabled
}

func (g *GetEmailTemplateResponseContent) GetExtraProperties() map[string]interface{} {
	return g.extraProperties
}

func (g *GetEmailTemplateResponseContent) require(field *big.Int) {
	if g.explicitFields == nil {
		g.explicitFields = big.NewInt(0)
	}
	g.explicitFields.Or(g.explicitFields, field)
}

// SetTemplate sets the Template field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (g *GetEmailTemplateResponseContent) SetTemplate(template *EmailTemplateNameEnum) {
	g.Template = template
	g.require(getEmailTemplateResponseContentFieldTemplate)
}

// SetBody sets the Body field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (g *GetEmailTemplateResponseContent) SetBody(body *string) {
	g.Body = body
	g.require(getEmailTemplateResponseContentFieldBody)
}

// SetFrom sets the From field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (g *GetEmailTemplateResponseContent) SetFrom(from *string) {
	g.From = from
	g.require(getEmailTemplateResponseContentFieldFrom)
}

// SetResultURL sets the ResultURL field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (g *GetEmailTemplateResponseContent) SetResultURL(resultURL *string) {
	g.ResultURL = resultURL
	g.require(getEmailTemplateResponseContentFieldResultURL)
}

// SetSubject sets the Subject field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (g *GetEmailTemplateResponseContent) SetSubject(subject *string) {
	g.Subject = subject
	g.require(getEmailTemplateResponseContentFieldSubject)
}

// SetSyntax sets the Syntax field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (g *GetEmailTemplateResponseContent) SetSyntax(syntax *string) {
	g.Syntax = syntax
	g.require(getEmailTemplateResponseContentFieldSyntax)
}

// SetURLLifetimeInSeconds sets the URLLifetimeInSeconds field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (g *GetEmailTemplateResponseContent) SetURLLifetimeInSeconds(urlLifetimeInSeconds *float64) {
	g.URLLifetimeInSeconds = urlLifetimeInSeconds
	g.require(getEmailTemplateResponseContentFieldURLLifetimeInSeconds)
}

// SetIncludeEmailInRedirect sets the IncludeEmailInRedirect field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (g *GetEmailTemplateResponseContent) SetIncludeEmailInRedirect(includeEmailInRedirect *bool) {
	g.IncludeEmailInRedirect = includeEmailInRedirect
	g.require(getEmailTemplateResponseContentFieldIncludeEmailInRedirect)
}

// SetEnabled sets the Enabled field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (g *GetEmailTemplateResponseContent) SetEnabled(enabled *bool) {
	g.Enabled = enabled
	g.require(getEmailTemplateResponseContentFieldEnabled)
}

func (g *GetEmailTemplateResponseContent) UnmarshalJSON(data []byte) error {
	type unmarshaler GetEmailTemplateResponseContent
	var value unmarshaler
	if err := json.Unmarshal(data, &value); err != nil {
		return err
	}
	*g = GetEmailTemplateResponseContent(value)
	extraProperties, err := internal.ExtractExtraProperties(data, *g)
	if err != nil {
		return err
	}
	g.extraProperties = extraProperties
	g.rawJSON = json.RawMessage(data)
	return nil
}

func (g *GetEmailTemplateResponseContent) MarshalJSON() ([]byte, error) {
	type embed GetEmailTemplateResponseContent
	var marshaler = struct {
		embed
	}{
		embed: embed(*g),
	}
	explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields)
	return json.Marshal(explicitMarshaler)
}

func (g *GetEmailTemplateResponseContent) String() string {
	if len(g.rawJSON) > 0 {
		if value, err := internal.StringifyJSON(g.rawJSON); err == nil {
			return value
		}
	}
	if value, err := internal.StringifyJSON(g); err == nil {
		return value
	}
	return fmt.Sprintf("%#v", g)
}

var (
	setEmailTemplateResponseContentFieldTemplate               = big.NewInt(1 << 0)
	setEmailTemplateResponseContentFieldBody                   = big.NewInt(1 << 1)
	setEmailTemplateResponseContentFieldFrom                   = big.NewInt(1 << 2)
	setEmailTemplateResponseContentFieldResultURL              = big.NewInt(1 << 3)
	setEmailTemplateResponseContentFieldSubject                = big.NewInt(1 << 4)
	setEmailTemplateResponseContentFieldSyntax                 = big.NewInt(1 << 5)
	setEmailTemplateResponseContentFieldURLLifetimeInSeconds   = big.NewInt(1 << 6)
	setEmailTemplateResponseContentFieldIncludeEmailInRedirect = big.NewInt(1 << 7)
	setEmailTemplateResponseContentFieldEnabled                = big.NewInt(1 << 8)
)

type SetEmailTemplateResponseContent struct {
	Template EmailTemplateNameEnum `json:"template" url:"template"`
	// Body of the email template.
	Body *string `json:"body,omitempty" url:"body,omitempty"`
	// Senders `from` email address.
	From *string `json:"from,omitempty" url:"from,omitempty"`
	// URL to redirect the user to after a successful action.
	ResultURL *string `json:"resultUrl,omitempty" url:"resultUrl,omitempty"`
	// Subject line of the email.
	Subject *string `json:"subject,omitempty" url:"subject,omitempty"`
	// Syntax of the template body.
	Syntax *string `json:"syntax,omitempty" url:"syntax,omitempty"`
	// Lifetime in seconds that the link within the email will be valid for.
	URLLifetimeInSeconds *float64 `json:"urlLifetimeInSeconds,omitempty" url:"urlLifetimeInSeconds,omitempty"`
	// Whether the `reset_email` and `verify_email` templates should include the user's email address as the `email` parameter in the returnUrl (true) or whether no email address should be included in the redirect (false). Defaults to true.
	IncludeEmailInRedirect *bool `json:"includeEmailInRedirect,omitempty" url:"includeEmailInRedirect,omitempty"`
	// Whether the template is enabled (true) or disabled (false).
	Enabled *bool `json:"enabled,omitempty" url:"enabled,omitempty"`

	// Private bitmask of fields set to an explicit value and therefore not to be omitted
	explicitFields *big.Int `json:"-" url:"-"`

	extraProperties map[string]interface{}
	rawJSON         json.RawMessage
}

func (s *SetEmailTemplateResponseContent) GetTemplate() EmailTemplateNameEnum {
	if s == nil {
		return ""
	}
	return s.Template
}

func (s *SetEmailTemplateResponseContent) GetBody() string {
	if s == nil || s.Body == nil {
		return ""
	}
	return *s.Body
}

func (s *SetEmailTemplateResponseContent) GetFrom() string {
	if s == nil || s.From == nil {
		return ""
	}
	return *s.From
}

func (s *SetEmailTemplateResponseContent) GetResultURL() string {
	if s == nil || s.ResultURL == nil {
		return ""
	}
	return *s.ResultURL
}

func (s *SetEmailTemplateResponseContent) GetSubject() string {
	if s == nil || s.Subject == nil {
		return ""
	}
	return *s.Subject
}

func (s *SetEmailTemplateResponseContent) GetSyntax() string {
	if s == nil || s.Syntax == nil {
		return ""
	}
	return *s.Syntax
}

func (s *SetEmailTemplateResponseContent) GetURLLifetimeInSeconds() float64 {
	if s == nil || s.URLLifetimeInSeconds == nil {
		return 0
	}
	return *s.URLLifetimeInSeconds
}

func (s *SetEmailTemplateResponseContent) GetIncludeEmailInRedirect() bool {
	if s == nil || s.IncludeEmailInRedirect == nil {
		return false
	}
	return *s.IncludeEmailInRedirect
}

func (s *SetEmailTemplateResponseContent) GetEnabled() bool {
	if s == nil || s.Enabled == nil {
		return false
	}
	return *s.Enabled
}

func (s *SetEmailTemplateResponseContent) GetExtraProperties() map[string]interface{} {
	return s.extraProperties
}

func (s *SetEmailTemplateResponseContent) require(field *big.Int) {
	if s.explicitFields == nil {
		s.explicitFields = big.NewInt(0)
	}
	s.explicitFields.Or(s.explicitFields, field)
}

// SetTemplate sets the Template field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *SetEmailTemplateResponseContent) SetTemplate(template EmailTemplateNameEnum) {
	s.Template = template
	s.require(setEmailTemplateResponseContentFieldTemplate)
}

// SetBody sets the Body field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *SetEmailTemplateResponseContent) SetBody(body *string) {
	s.Body = body
	s.require(setEmailTemplateResponseContentFieldBody)
}

// SetFrom sets the From field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *SetEmailTemplateResponseContent) SetFrom(from *string) {
	s.From = from
	s.require(setEmailTemplateResponseContentFieldFrom)
}

// SetResultURL sets the ResultURL field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *SetEmailTemplateResponseContent) SetResultURL(resultURL *string) {
	s.ResultURL = resultURL
	s.require(setEmailTemplateResponseContentFieldResultURL)
}

// SetSubject sets the Subject field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *SetEmailTemplateResponseContent) SetSubject(subject *string) {
	s.Subject = subject
	s.require(setEmailTemplateResponseContentFieldSubject)
}

// SetSyntax sets the Syntax field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *SetEmailTemplateResponseContent) SetSyntax(syntax *string) {
	s.Syntax = syntax
	s.require(setEmailTemplateResponseContentFieldSyntax)
}

// SetURLLifetimeInSeconds sets the URLLifetimeInSeconds field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *SetEmailTemplateResponseContent) SetURLLifetimeInSeconds(urlLifetimeInSeconds *float64) {
	s.URLLifetimeInSeconds = urlLifetimeInSeconds
	s.require(setEmailTemplateResponseContentFieldURLLifetimeInSeconds)
}

// SetIncludeEmailInRedirect sets the IncludeEmailInRedirect field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *SetEmailTemplateResponseContent) SetIncludeEmailInRedirect(includeEmailInRedirect *bool) {
	s.IncludeEmailInRedirect = includeEmailInRedirect
	s.require(setEmailTemplateResponseContentFieldIncludeEmailInRedirect)
}

// SetEnabled sets the Enabled field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *SetEmailTemplateResponseContent) SetEnabled(enabled *bool) {
	s.Enabled = enabled
	s.require(setEmailTemplateResponseContentFieldEnabled)
}

func (s *SetEmailTemplateResponseContent) UnmarshalJSON(data []byte) error {
	type unmarshaler SetEmailTemplateResponseContent
	var value unmarshaler
	if err := json.Unmarshal(data, &value); err != nil {
		return err
	}
	*s = SetEmailTemplateResponseContent(value)
	extraProperties, err := internal.ExtractExtraProperties(data, *s)
	if err != nil {
		return err
	}
	s.extraProperties = extraProperties
	s.rawJSON = json.RawMessage(data)
	return nil
}

func (s *SetEmailTemplateResponseContent) MarshalJSON() ([]byte, error) {
	type embed SetEmailTemplateResponseContent
	var marshaler = struct {
		embed
	}{
		embed: embed(*s),
	}
	explicitMarshaler := internal.HandleExplicitFields(marshaler, s.explicitFields)
	return json.Marshal(explicitMarshaler)
}

func (s *SetEmailTemplateResponseContent) String() string {
	if len(s.rawJSON) > 0 {
		if value, err := internal.StringifyJSON(s.rawJSON); err == nil {
			return value
		}
	}
	if value, err := internal.StringifyJSON(s); err == nil {
		return value
	}
	return fmt.Sprintf("%#v", s)
}

var (
	updateEmailTemplateResponseContentFieldTemplate               = big.NewInt(1 << 0)
	updateEmailTemplateResponseContentFieldBody                   = big.NewInt(1 << 1)
	updateEmailTemplateResponseContentFieldFrom                   = big.NewInt(1 << 2)
	updateEmailTemplateResponseContentFieldResultURL              = big.NewInt(1 << 3)
	updateEmailTemplateResponseContentFieldSubject                = big.NewInt(1 << 4)
	updateEmailTemplateResponseContentFieldSyntax                 = big.NewInt(1 << 5)
	updateEmailTemplateResponseContentFieldURLLifetimeInSeconds   = big.NewInt(1 << 6)
	updateEmailTemplateResponseContentFieldIncludeEmailInRedirect = big.NewInt(1 << 7)
	updateEmailTemplateResponseContentFieldEnabled                = big.NewInt(1 << 8)
)

type UpdateEmailTemplateResponseContent struct {
	Template *EmailTemplateNameEnum `json:"template,omitempty" url:"template,omitempty"`
	// Body of the email template.
	Body *string `json:"body,omitempty" url:"body,omitempty"`
	// Senders `from` email address.
	From *string `json:"from,omitempty" url:"from,omitempty"`
	// URL to redirect the user to after a successful action.
	ResultURL *string `json:"resultUrl,omitempty" url:"resultUrl,omitempty"`
	// Subject line of the email.
	Subject *string `json:"subject,omitempty" url:"subject,omitempty"`
	// Syntax of the template body.
	Syntax *string `json:"syntax,omitempty" url:"syntax,omitempty"`
	// Lifetime in seconds that the link within the email will be valid for.
	URLLifetimeInSeconds *float64 `json:"urlLifetimeInSeconds,omitempty" url:"urlLifetimeInSeconds,omitempty"`
	// Whether the `reset_email` and `verify_email` templates should include the user's email address as the `email` parameter in the returnUrl (true) or whether no email address should be included in the redirect (false). Defaults to true.
	IncludeEmailInRedirect *bool `json:"includeEmailInRedirect,omitempty" url:"includeEmailInRedirect,omitempty"`
	// Whether the template is enabled (true) or disabled (false).
	Enabled *bool `json:"enabled,omitempty" url:"enabled,omitempty"`

	// Private bitmask of fields set to an explicit value and therefore not to be omitted
	explicitFields *big.Int `json:"-" url:"-"`

	extraProperties map[string]interface{}
	rawJSON         json.RawMessage
}

func (u *UpdateEmailTemplateResponseContent) GetTemplate() EmailTemplateNameEnum {
	if u == nil || u.Template == nil {
		return ""
	}
	return *u.Template
}

func (u *UpdateEmailTemplateResponseContent) GetBody() string {
	if u == nil || u.Body == nil {
		return ""
	}
	return *u.Body
}

func (u *UpdateEmailTemplateResponseContent) GetFrom() string {
	if u == nil || u.From == nil {
		return ""
	}
	return *u.From
}

func (u *UpdateEmailTemplateResponseContent) GetResultURL() string {
	if u == nil || u.ResultURL == nil {
		return ""
	}
	return *u.ResultURL
}

func (u *UpdateEmailTemplateResponseContent) GetSubject() string {
	if u == nil || u.Subject == nil {
		return ""
	}
	return *u.Subject
}

func (u *UpdateEmailTemplateResponseContent) GetSyntax() string {
	if u == nil || u.Syntax == nil {
		return ""
	}
	return *u.Syntax
}

func (u *UpdateEmailTemplateResponseContent) GetURLLifetimeInSeconds() float64 {
	if u == nil || u.URLLifetimeInSeconds == nil {
		return 0
	}
	return *u.URLLifetimeInSeconds
}

func (u *UpdateEmailTemplateResponseContent) GetIncludeEmailInRedirect() bool {
	if u == nil || u.IncludeEmailInRedirect == nil {
		return false
	}
	return *u.IncludeEmailInRedirect
}

func (u *UpdateEmailTemplateResponseContent) GetEnabled() bool {
	if u == nil || u.Enabled == nil {
		return false
	}
	return *u.Enabled
}

func (u *UpdateEmailTemplateResponseContent) GetExtraProperties() map[string]interface{} {
	return u.extraProperties
}

func (u *UpdateEmailTemplateResponseContent) require(field *big.Int) {
	if u.explicitFields == nil {
		u.explicitFields = big.NewInt(0)
	}
	u.explicitFields.Or(u.explicitFields, field)
}

// SetTemplate sets the Template field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *UpdateEmailTemplateResponseContent) SetTemplate(template *EmailTemplateNameEnum) {
	u.Template = template
	u.require(updateEmailTemplateResponseContentFieldTemplate)
}

// SetBody sets the Body field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *UpdateEmailTemplateResponseContent) SetBody(body *string) {
	u.Body = body
	u.require(updateEmailTemplateResponseContentFieldBody)
}

// SetFrom sets the From field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *UpdateEmailTemplateResponseContent) SetFrom(from *string) {
	u.From = from
	u.require(updateEmailTemplateResponseContentFieldFrom)
}

// SetResultURL sets the ResultURL field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *UpdateEmailTemplateResponseContent) SetResultURL(resultURL *string) {
	u.ResultURL = resultURL
	u.require(updateEmailTemplateResponseContentFieldResultURL)
}

// SetSubject sets the Subject field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *UpdateEmailTemplateResponseContent) SetSubject(subject *string) {
	u.Subject = subject
	u.require(updateEmailTemplateResponseContentFieldSubject)
}

// SetSyntax sets the Syntax field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *UpdateEmailTemplateResponseContent) SetSyntax(syntax *string) {
	u.Syntax = syntax
	u.require(updateEmailTemplateResponseContentFieldSyntax)
}

// SetURLLifetimeInSeconds sets the URLLifetimeInSeconds field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *UpdateEmailTemplateResponseContent) SetURLLifetimeInSeconds(urlLifetimeInSeconds *float64) {
	u.URLLifetimeInSeconds = urlLifetimeInSeconds
	u.require(updateEmailTemplateResponseContentFieldURLLifetimeInSeconds)
}

// SetIncludeEmailInRedirect sets the IncludeEmailInRedirect field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *UpdateEmailTemplateResponseContent) SetIncludeEmailInRedirect(includeEmailInRedirect *bool) {
	u.IncludeEmailInRedirect = includeEmailInRedirect
	u.require(updateEmailTemplateResponseContentFieldIncludeEmailInRedirect)
}

// SetEnabled sets the Enabled field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *UpdateEmailTemplateResponseContent) SetEnabled(enabled *bool) {
	u.Enabled = enabled
	u.require(updateEmailTemplateResponseContentFieldEnabled)
}

func (u *UpdateEmailTemplateResponseContent) UnmarshalJSON(data []byte) error {
	type unmarshaler UpdateEmailTemplateResponseContent
	var value unmarshaler
	if err := json.Unmarshal(data, &value); err != nil {
		return err
	}
	*u = UpdateEmailTemplateResponseContent(value)
	extraProperties, err := internal.ExtractExtraProperties(data, *u)
	if err != nil {
		return err
	}
	u.extraProperties = extraProperties
	u.rawJSON = json.RawMessage(data)
	return nil
}

func (u *UpdateEmailTemplateResponseContent) MarshalJSON() ([]byte, error) {
	type embed UpdateEmailTemplateResponseContent
	var marshaler = struct {
		embed
	}{
		embed: embed(*u),
	}
	explicitMarshaler := internal.HandleExplicitFields(marshaler, u.explicitFields)
	return json.Marshal(explicitMarshaler)
}

func (u *UpdateEmailTemplateResponseContent) String() string {
	if len(u.rawJSON) > 0 {
		if value, err := internal.StringifyJSON(u.rawJSON); err == nil {
			return value
		}
	}
	if value, err := internal.StringifyJSON(u); err == nil {
		return value
	}
	return fmt.Sprintf("%#v", u)
}
