// Code generated by Fern. DO NOT EDIT.

package api

import (
	json "encoding/json"
	fmt "fmt"
	big "math/big"
	internal "pentagi/pkg/observability/langfuse/api/internal"
)

var (
	opentelemetryExportTracesRequestFieldResourceSpans = big.NewInt(1 << 0)
)

type OpentelemetryExportTracesRequest struct {
	// Array of resource spans containing trace data as defined in the OTLP specification
	ResourceSpans []*OtelResourceSpan `json:"resourceSpans" url:"-"`

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

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

// SetResourceSpans sets the ResourceSpans field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *OpentelemetryExportTracesRequest) SetResourceSpans(resourceSpans []*OtelResourceSpan) {
	o.ResourceSpans = resourceSpans
	o.require(opentelemetryExportTracesRequestFieldResourceSpans)
}

func (o *OpentelemetryExportTracesRequest) UnmarshalJSON(data []byte) error {
	type unmarshaler OpentelemetryExportTracesRequest
	var body unmarshaler
	if err := json.Unmarshal(data, &body); err != nil {
		return err
	}
	*o = OpentelemetryExportTracesRequest(body)
	return nil
}

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

// Key-value attribute pair for resources, scopes, or spans
var (
	otelAttributeFieldKey   = big.NewInt(1 << 0)
	otelAttributeFieldValue = big.NewInt(1 << 1)
)

type OtelAttribute struct {
	// Attribute key (e.g., "service.name", "langfuse.observation.type")
	Key *string `json:"key,omitempty" url:"key,omitempty"`
	// Attribute value
	Value *OtelAttributeValue `json:"value,omitempty" url:"value,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 (o *OtelAttribute) GetKey() *string {
	if o == nil {
		return nil
	}
	return o.Key
}

func (o *OtelAttribute) GetValue() *OtelAttributeValue {
	if o == nil {
		return nil
	}
	return o.Value
}

func (o *OtelAttribute) GetExtraProperties() map[string]interface{} {
	return o.extraProperties
}

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

// SetKey sets the Key field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *OtelAttribute) SetKey(key *string) {
	o.Key = key
	o.require(otelAttributeFieldKey)
}

// SetValue sets the Value field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *OtelAttribute) SetValue(value *OtelAttributeValue) {
	o.Value = value
	o.require(otelAttributeFieldValue)
}

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

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

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

// Attribute value wrapper supporting different value types
var (
	otelAttributeValueFieldStringValue = big.NewInt(1 << 0)
	otelAttributeValueFieldIntValue    = big.NewInt(1 << 1)
	otelAttributeValueFieldDoubleValue = big.NewInt(1 << 2)
	otelAttributeValueFieldBoolValue   = big.NewInt(1 << 3)
)

type OtelAttributeValue struct {
	// String value
	StringValue *string `json:"stringValue,omitempty" url:"stringValue,omitempty"`
	// Integer value
	IntValue *int `json:"intValue,omitempty" url:"intValue,omitempty"`
	// Double value
	DoubleValue *float64 `json:"doubleValue,omitempty" url:"doubleValue,omitempty"`
	// Boolean value
	BoolValue *bool `json:"boolValue,omitempty" url:"boolValue,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 (o *OtelAttributeValue) GetStringValue() *string {
	if o == nil {
		return nil
	}
	return o.StringValue
}

func (o *OtelAttributeValue) GetIntValue() *int {
	if o == nil {
		return nil
	}
	return o.IntValue
}

func (o *OtelAttributeValue) GetDoubleValue() *float64 {
	if o == nil {
		return nil
	}
	return o.DoubleValue
}

func (o *OtelAttributeValue) GetBoolValue() *bool {
	if o == nil {
		return nil
	}
	return o.BoolValue
}

func (o *OtelAttributeValue) GetExtraProperties() map[string]interface{} {
	return o.extraProperties
}

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

// SetStringValue sets the StringValue field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *OtelAttributeValue) SetStringValue(stringValue *string) {
	o.StringValue = stringValue
	o.require(otelAttributeValueFieldStringValue)
}

// SetIntValue sets the IntValue field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *OtelAttributeValue) SetIntValue(intValue *int) {
	o.IntValue = intValue
	o.require(otelAttributeValueFieldIntValue)
}

// SetDoubleValue sets the DoubleValue field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *OtelAttributeValue) SetDoubleValue(doubleValue *float64) {
	o.DoubleValue = doubleValue
	o.require(otelAttributeValueFieldDoubleValue)
}

// SetBoolValue sets the BoolValue field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *OtelAttributeValue) SetBoolValue(boolValue *bool) {
	o.BoolValue = boolValue
	o.require(otelAttributeValueFieldBoolValue)
}

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

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

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

// Resource attributes identifying the source of telemetry
var (
	otelResourceFieldAttributes = big.NewInt(1 << 0)
)

type OtelResource struct {
	// Resource attributes like service.name, service.version, etc.
	Attributes []*OtelAttribute `json:"attributes,omitempty" url:"attributes,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 (o *OtelResource) GetAttributes() []*OtelAttribute {
	if o == nil {
		return nil
	}
	return o.Attributes
}

func (o *OtelResource) GetExtraProperties() map[string]interface{} {
	return o.extraProperties
}

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

// SetAttributes sets the Attributes field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *OtelResource) SetAttributes(attributes []*OtelAttribute) {
	o.Attributes = attributes
	o.require(otelResourceFieldAttributes)
}

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

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

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

// Represents a collection of spans from a single resource as per OTLP specification
var (
	otelResourceSpanFieldResource   = big.NewInt(1 << 0)
	otelResourceSpanFieldScopeSpans = big.NewInt(1 << 1)
)

type OtelResourceSpan struct {
	// Resource information
	Resource *OtelResource `json:"resource,omitempty" url:"resource,omitempty"`
	// Array of scope spans
	ScopeSpans []*OtelScopeSpan `json:"scopeSpans,omitempty" url:"scopeSpans,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 (o *OtelResourceSpan) GetResource() *OtelResource {
	if o == nil {
		return nil
	}
	return o.Resource
}

func (o *OtelResourceSpan) GetScopeSpans() []*OtelScopeSpan {
	if o == nil {
		return nil
	}
	return o.ScopeSpans
}

func (o *OtelResourceSpan) GetExtraProperties() map[string]interface{} {
	return o.extraProperties
}

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

// SetResource sets the Resource field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *OtelResourceSpan) SetResource(resource *OtelResource) {
	o.Resource = resource
	o.require(otelResourceSpanFieldResource)
}

// SetScopeSpans sets the ScopeSpans field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *OtelResourceSpan) SetScopeSpans(scopeSpans []*OtelScopeSpan) {
	o.ScopeSpans = scopeSpans
	o.require(otelResourceSpanFieldScopeSpans)
}

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

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

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

// Instrumentation scope information
var (
	otelScopeFieldName       = big.NewInt(1 << 0)
	otelScopeFieldVersion    = big.NewInt(1 << 1)
	otelScopeFieldAttributes = big.NewInt(1 << 2)
)

type OtelScope struct {
	// Instrumentation scope name
	Name *string `json:"name,omitempty" url:"name,omitempty"`
	// Instrumentation scope version
	Version *string `json:"version,omitempty" url:"version,omitempty"`
	// Additional scope attributes
	Attributes []*OtelAttribute `json:"attributes,omitempty" url:"attributes,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 (o *OtelScope) GetName() *string {
	if o == nil {
		return nil
	}
	return o.Name
}

func (o *OtelScope) GetVersion() *string {
	if o == nil {
		return nil
	}
	return o.Version
}

func (o *OtelScope) GetAttributes() []*OtelAttribute {
	if o == nil {
		return nil
	}
	return o.Attributes
}

func (o *OtelScope) GetExtraProperties() map[string]interface{} {
	return o.extraProperties
}

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

// 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 (o *OtelScope) SetName(name *string) {
	o.Name = name
	o.require(otelScopeFieldName)
}

// SetVersion sets the Version field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *OtelScope) SetVersion(version *string) {
	o.Version = version
	o.require(otelScopeFieldVersion)
}

// SetAttributes sets the Attributes field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *OtelScope) SetAttributes(attributes []*OtelAttribute) {
	o.Attributes = attributes
	o.require(otelScopeFieldAttributes)
}

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

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

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

// Collection of spans from a single instrumentation scope
var (
	otelScopeSpanFieldScope = big.NewInt(1 << 0)
	otelScopeSpanFieldSpans = big.NewInt(1 << 1)
)

type OtelScopeSpan struct {
	// Instrumentation scope information
	Scope *OtelScope `json:"scope,omitempty" url:"scope,omitempty"`
	// Array of spans
	Spans []*OtelSpan `json:"spans,omitempty" url:"spans,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 (o *OtelScopeSpan) GetScope() *OtelScope {
	if o == nil {
		return nil
	}
	return o.Scope
}

func (o *OtelScopeSpan) GetSpans() []*OtelSpan {
	if o == nil {
		return nil
	}
	return o.Spans
}

func (o *OtelScopeSpan) GetExtraProperties() map[string]interface{} {
	return o.extraProperties
}

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

// SetScope sets the Scope field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *OtelScopeSpan) SetScope(scope *OtelScope) {
	o.Scope = scope
	o.require(otelScopeSpanFieldScope)
}

// SetSpans sets the Spans field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *OtelScopeSpan) SetSpans(spans []*OtelSpan) {
	o.Spans = spans
	o.require(otelScopeSpanFieldSpans)
}

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

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

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

// Individual span representing a unit of work or operation
var (
	otelSpanFieldTraceID           = big.NewInt(1 << 0)
	otelSpanFieldSpanID            = big.NewInt(1 << 1)
	otelSpanFieldParentSpanID      = big.NewInt(1 << 2)
	otelSpanFieldName              = big.NewInt(1 << 3)
	otelSpanFieldKind              = big.NewInt(1 << 4)
	otelSpanFieldStartTimeUnixNano = big.NewInt(1 << 5)
	otelSpanFieldEndTimeUnixNano   = big.NewInt(1 << 6)
	otelSpanFieldAttributes        = big.NewInt(1 << 7)
	otelSpanFieldStatus            = big.NewInt(1 << 8)
)

type OtelSpan struct {
	// Trace ID (16 bytes, hex-encoded string in JSON or Buffer in binary)
	TraceID interface{} `json:"traceId,omitempty" url:"traceId,omitempty"`
	// Span ID (8 bytes, hex-encoded string in JSON or Buffer in binary)
	SpanID interface{} `json:"spanId,omitempty" url:"spanId,omitempty"`
	// Parent span ID if this is a child span
	ParentSpanID interface{} `json:"parentSpanId,omitempty" url:"parentSpanId,omitempty"`
	// Span name describing the operation
	Name *string `json:"name,omitempty" url:"name,omitempty"`
	// Span kind (1=INTERNAL, 2=SERVER, 3=CLIENT, 4=PRODUCER, 5=CONSUMER)
	Kind *int `json:"kind,omitempty" url:"kind,omitempty"`
	// Start time in nanoseconds since Unix epoch
	StartTimeUnixNano interface{} `json:"startTimeUnixNano,omitempty" url:"startTimeUnixNano,omitempty"`
	// End time in nanoseconds since Unix epoch
	EndTimeUnixNano interface{} `json:"endTimeUnixNano,omitempty" url:"endTimeUnixNano,omitempty"`
	// Span attributes including Langfuse-specific attributes (langfuse.observation.*)
	Attributes []*OtelAttribute `json:"attributes,omitempty" url:"attributes,omitempty"`
	// Span status object
	Status interface{} `json:"status,omitempty" url:"status,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 (o *OtelSpan) GetTraceID() interface{} {
	if o == nil {
		return nil
	}
	return o.TraceID
}

func (o *OtelSpan) GetSpanID() interface{} {
	if o == nil {
		return nil
	}
	return o.SpanID
}

func (o *OtelSpan) GetParentSpanID() interface{} {
	if o == nil {
		return nil
	}
	return o.ParentSpanID
}

func (o *OtelSpan) GetName() *string {
	if o == nil {
		return nil
	}
	return o.Name
}

func (o *OtelSpan) GetKind() *int {
	if o == nil {
		return nil
	}
	return o.Kind
}

func (o *OtelSpan) GetStartTimeUnixNano() interface{} {
	if o == nil {
		return nil
	}
	return o.StartTimeUnixNano
}

func (o *OtelSpan) GetEndTimeUnixNano() interface{} {
	if o == nil {
		return nil
	}
	return o.EndTimeUnixNano
}

func (o *OtelSpan) GetAttributes() []*OtelAttribute {
	if o == nil {
		return nil
	}
	return o.Attributes
}

func (o *OtelSpan) GetStatus() interface{} {
	if o == nil {
		return nil
	}
	return o.Status
}

func (o *OtelSpan) GetExtraProperties() map[string]interface{} {
	return o.extraProperties
}

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

// SetTraceID sets the TraceID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *OtelSpan) SetTraceID(traceID interface{}) {
	o.TraceID = traceID
	o.require(otelSpanFieldTraceID)
}

// SetSpanID sets the SpanID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *OtelSpan) SetSpanID(spanID interface{}) {
	o.SpanID = spanID
	o.require(otelSpanFieldSpanID)
}

// SetParentSpanID sets the ParentSpanID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *OtelSpan) SetParentSpanID(parentSpanID interface{}) {
	o.ParentSpanID = parentSpanID
	o.require(otelSpanFieldParentSpanID)
}

// 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 (o *OtelSpan) SetName(name *string) {
	o.Name = name
	o.require(otelSpanFieldName)
}

// SetKind sets the Kind field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *OtelSpan) SetKind(kind *int) {
	o.Kind = kind
	o.require(otelSpanFieldKind)
}

// SetStartTimeUnixNano sets the StartTimeUnixNano field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *OtelSpan) SetStartTimeUnixNano(startTimeUnixNano interface{}) {
	o.StartTimeUnixNano = startTimeUnixNano
	o.require(otelSpanFieldStartTimeUnixNano)
}

// SetEndTimeUnixNano sets the EndTimeUnixNano field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *OtelSpan) SetEndTimeUnixNano(endTimeUnixNano interface{}) {
	o.EndTimeUnixNano = endTimeUnixNano
	o.require(otelSpanFieldEndTimeUnixNano)
}

// SetAttributes sets the Attributes field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *OtelSpan) SetAttributes(attributes []*OtelAttribute) {
	o.Attributes = attributes
	o.require(otelSpanFieldAttributes)
}

// 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 (o *OtelSpan) SetStatus(status interface{}) {
	o.Status = status
	o.require(otelSpanFieldStatus)
}

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

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

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

// Response from trace export request. Empty object indicates success.
type OtelTraceResponse struct {

	// 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 (o *OtelTraceResponse) GetExtraProperties() map[string]interface{} {
	return o.extraProperties
}

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

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

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

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