// 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 (
	createRoleResponseContentFieldID          = big.NewInt(1 << 0)
	createRoleResponseContentFieldName        = big.NewInt(1 << 1)
	createRoleResponseContentFieldDescription = big.NewInt(1 << 2)
)

type CreateRoleResponseContent struct {
	// ID for this role.
	ID *string `json:"id,omitempty" url:"id,omitempty"`
	// Name of this role.
	Name *string `json:"name,omitempty" url:"name,omitempty"`
	// Description of this role.
	Description *string `json:"description,omitempty" url:"description,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 *CreateRoleResponseContent) GetID() string {
	if c == nil || c.ID == nil {
		return ""
	}
	return *c.ID
}

func (c *CreateRoleResponseContent) GetName() string {
	if c == nil || c.Name == nil {
		return ""
	}
	return *c.Name
}

func (c *CreateRoleResponseContent) GetDescription() string {
	if c == nil || c.Description == nil {
		return ""
	}
	return *c.Description
}

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

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

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

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

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

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

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

func (c *CreateRoleResponseContent) 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)
}

var (
	getRoleResponseContentFieldID          = big.NewInt(1 << 0)
	getRoleResponseContentFieldName        = big.NewInt(1 << 1)
	getRoleResponseContentFieldDescription = big.NewInt(1 << 2)
)

type GetRoleResponseContent struct {
	// ID for this role.
	ID *string `json:"id,omitempty" url:"id,omitempty"`
	// Name of this role.
	Name *string `json:"name,omitempty" url:"name,omitempty"`
	// Description of this role.
	Description *string `json:"description,omitempty" url:"description,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 *GetRoleResponseContent) GetID() string {
	if g == nil || g.ID == nil {
		return ""
	}
	return *g.ID
}

func (g *GetRoleResponseContent) GetName() string {
	if g == nil || g.Name == nil {
		return ""
	}
	return *g.Name
}

func (g *GetRoleResponseContent) GetDescription() string {
	if g == nil || g.Description == nil {
		return ""
	}
	return *g.Description
}

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

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

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

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

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

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

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

func (g *GetRoleResponseContent) 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 (
	listRolesOffsetPaginatedResponseContentFieldStart = big.NewInt(1 << 0)
	listRolesOffsetPaginatedResponseContentFieldLimit = big.NewInt(1 << 1)
	listRolesOffsetPaginatedResponseContentFieldTotal = big.NewInt(1 << 2)
	listRolesOffsetPaginatedResponseContentFieldRoles = big.NewInt(1 << 3)
)

type ListRolesOffsetPaginatedResponseContent struct {
	Start *float64 `json:"start,omitempty" url:"start,omitempty"`
	Limit *float64 `json:"limit,omitempty" url:"limit,omitempty"`
	Total *float64 `json:"total,omitempty" url:"total,omitempty"`
	Roles []*Role  `json:"roles,omitempty" url:"roles,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 (l *ListRolesOffsetPaginatedResponseContent) GetStart() float64 {
	if l == nil || l.Start == nil {
		return 0
	}
	return *l.Start
}

func (l *ListRolesOffsetPaginatedResponseContent) GetLimit() float64 {
	if l == nil || l.Limit == nil {
		return 0
	}
	return *l.Limit
}

func (l *ListRolesOffsetPaginatedResponseContent) GetTotal() float64 {
	if l == nil || l.Total == nil {
		return 0
	}
	return *l.Total
}

func (l *ListRolesOffsetPaginatedResponseContent) GetRoles() []*Role {
	if l == nil || l.Roles == nil {
		return nil
	}
	return l.Roles
}

func (l *ListRolesOffsetPaginatedResponseContent) GetExtraProperties() map[string]interface{} {
	return l.extraProperties
}

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

// SetStart sets the Start field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (l *ListRolesOffsetPaginatedResponseContent) SetStart(start *float64) {
	l.Start = start
	l.require(listRolesOffsetPaginatedResponseContentFieldStart)
}

// SetLimit sets the Limit field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (l *ListRolesOffsetPaginatedResponseContent) SetLimit(limit *float64) {
	l.Limit = limit
	l.require(listRolesOffsetPaginatedResponseContentFieldLimit)
}

// SetTotal sets the Total field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (l *ListRolesOffsetPaginatedResponseContent) SetTotal(total *float64) {
	l.Total = total
	l.require(listRolesOffsetPaginatedResponseContentFieldTotal)
}

// SetRoles sets the Roles field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (l *ListRolesOffsetPaginatedResponseContent) SetRoles(roles []*Role) {
	l.Roles = roles
	l.require(listRolesOffsetPaginatedResponseContentFieldRoles)
}

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

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

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

var (
	updateRoleResponseContentFieldID          = big.NewInt(1 << 0)
	updateRoleResponseContentFieldName        = big.NewInt(1 << 1)
	updateRoleResponseContentFieldDescription = big.NewInt(1 << 2)
)

type UpdateRoleResponseContent struct {
	// ID for this role.
	ID *string `json:"id,omitempty" url:"id,omitempty"`
	// Name of this role.
	Name *string `json:"name,omitempty" url:"name,omitempty"`
	// Description of this role.
	Description *string `json:"description,omitempty" url:"description,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 *UpdateRoleResponseContent) GetID() string {
	if u == nil || u.ID == nil {
		return ""
	}
	return *u.ID
}

func (u *UpdateRoleResponseContent) GetName() string {
	if u == nil || u.Name == nil {
		return ""
	}
	return *u.Name
}

func (u *UpdateRoleResponseContent) GetDescription() string {
	if u == nil || u.Description == nil {
		return ""
	}
	return *u.Description
}

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

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

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

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

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

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

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

func (u *UpdateRoleResponseContent) 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)
}
