// 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 (
	getJobResponseContentFieldStatus          = big.NewInt(1 << 0)
	getJobResponseContentFieldType            = big.NewInt(1 << 1)
	getJobResponseContentFieldCreatedAt       = big.NewInt(1 << 2)
	getJobResponseContentFieldID              = big.NewInt(1 << 3)
	getJobResponseContentFieldConnectionID    = big.NewInt(1 << 4)
	getJobResponseContentFieldLocation        = big.NewInt(1 << 5)
	getJobResponseContentFieldPercentageDone  = big.NewInt(1 << 6)
	getJobResponseContentFieldTimeLeftSeconds = big.NewInt(1 << 7)
	getJobResponseContentFieldFormat          = big.NewInt(1 << 8)
	getJobResponseContentFieldStatusDetails   = big.NewInt(1 << 9)
)

type GetJobResponseContent struct {
	// Status of this job.
	Status string `json:"status" url:"status"`
	// Type of job this is.
	Type string `json:"type" url:"type"`
	// When this job was created.
	CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"`
	// ID of this job.
	ID string `json:"id" url:"id"`
	// connection_id of the connection this job uses.
	ConnectionID *string `json:"connection_id,omitempty" url:"connection_id,omitempty"`
	// URL to download the result of this job.
	Location *string `json:"location,omitempty" url:"location,omitempty"`
	// Completion percentage of this job.
	PercentageDone *int `json:"percentage_done,omitempty" url:"percentage_done,omitempty"`
	// Estimated time remaining before job completes.
	TimeLeftSeconds *int               `json:"time_left_seconds,omitempty" url:"time_left_seconds,omitempty"`
	Format          *JobFileFormatEnum `json:"format,omitempty" url:"format,omitempty"`
	// Status details.
	StatusDetails *string `json:"status_details,omitempty" url:"status_details,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{} `json:"-" url:"-"`

	rawJSON json.RawMessage
}

func (g *GetJobResponseContent) GetStatus() string {
	if g == nil {
		return ""
	}
	return g.Status
}

func (g *GetJobResponseContent) GetType() string {
	if g == nil {
		return ""
	}
	return g.Type
}

func (g *GetJobResponseContent) GetCreatedAt() string {
	if g == nil || g.CreatedAt == nil {
		return ""
	}
	return *g.CreatedAt
}

func (g *GetJobResponseContent) GetID() string {
	if g == nil {
		return ""
	}
	return g.ID
}

func (g *GetJobResponseContent) GetConnectionID() string {
	if g == nil || g.ConnectionID == nil {
		return ""
	}
	return *g.ConnectionID
}

func (g *GetJobResponseContent) GetLocation() string {
	if g == nil || g.Location == nil {
		return ""
	}
	return *g.Location
}

func (g *GetJobResponseContent) GetPercentageDone() int {
	if g == nil || g.PercentageDone == nil {
		return 0
	}
	return *g.PercentageDone
}

func (g *GetJobResponseContent) GetTimeLeftSeconds() int {
	if g == nil || g.TimeLeftSeconds == nil {
		return 0
	}
	return *g.TimeLeftSeconds
}

func (g *GetJobResponseContent) GetFormat() JobFileFormatEnum {
	if g == nil || g.Format == nil {
		return ""
	}
	return *g.Format
}

func (g *GetJobResponseContent) GetStatusDetails() string {
	if g == nil || g.StatusDetails == nil {
		return ""
	}
	return *g.StatusDetails
}

func (g *GetJobResponseContent) GetExtraProperties() map[string]interface{} {
	return g.ExtraProperties
}

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

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

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

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

// 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 *GetJobResponseContent) SetID(id string) {
	g.ID = id
	g.require(getJobResponseContentFieldID)
}

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

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

// SetPercentageDone sets the PercentageDone field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (g *GetJobResponseContent) SetPercentageDone(percentageDone *int) {
	g.PercentageDone = percentageDone
	g.require(getJobResponseContentFieldPercentageDone)
}

// SetTimeLeftSeconds sets the TimeLeftSeconds field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (g *GetJobResponseContent) SetTimeLeftSeconds(timeLeftSeconds *int) {
	g.TimeLeftSeconds = timeLeftSeconds
	g.require(getJobResponseContentFieldTimeLeftSeconds)
}

// SetFormat sets the Format field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (g *GetJobResponseContent) SetFormat(format *JobFileFormatEnum) {
	g.Format = format
	g.require(getJobResponseContentFieldFormat)
}

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

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

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

func (g *GetJobResponseContent) 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)
}
