// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.

package model

import (
	json "encoding/json"
	easyjson "github.com/mailru/easyjson"
	jlexer "github.com/mailru/easyjson/jlexer"
	jwriter "github.com/mailru/easyjson/jwriter"
)

// suppress unused package warning
var (
	_ *json.RawMessage
	_ *jlexer.Lexer
	_ *jwriter.Writer
	_ easyjson.Marshaler
)

func easyjson6ff3ac1dDecodeGoSignozIoSignozPkgQueryServiceModel(in *jlexer.Lexer, out *SearchSpanResponseItem) {
	isTopLevel := in.IsStart()
	if in.IsNull() {
		if isTopLevel {
			in.Consumed()
		}
		in.Skip()
		return
	}
	in.Delim('{')
	for !in.IsDelim('}') {
		key := in.UnsafeFieldName(false)
		in.WantColon()
		if in.IsNull() {
			in.Skip()
			in.WantComma()
			continue
		}
		switch key {
		case "timestamp":
			out.TimeUnixNano = uint64(in.Uint64())
		case "durationNano":
			out.DurationNano = int64(in.Int64())
		case "spanId":
			out.SpanID = string(in.String())
		case "rootSpanId":
			out.RootSpanID = string(in.String())
		case "traceId":
			out.TraceID = string(in.String())
		case "hasError":
			out.HasError = bool(in.Bool())
		case "kind":
			out.Kind = int32(in.Int32())
		case "serviceName":
			out.ServiceName = string(in.String())
		case "name":
			out.Name = string(in.String())
		case "references":
			if in.IsNull() {
				in.Skip()
				out.References = nil
			} else {
				in.Delim('[')
				if out.References == nil {
					if !in.IsDelim(']') {
						out.References = make([]OtelSpanRef, 0, 1)
					} else {
						out.References = []OtelSpanRef{}
					}
				} else {
					out.References = (out.References)[:0]
				}
				for !in.IsDelim(']') {
					var v1 OtelSpanRef
					easyjson6ff3ac1dDecodeGoSignozIoSignozPkgQueryServiceModel1(in, &v1)
					out.References = append(out.References, v1)
					in.WantComma()
				}
				in.Delim(']')
			}
		case "tagMap":
			if in.IsNull() {
				in.Skip()
			} else {
				in.Delim('{')
				out.TagMap = make(map[string]string)
				for !in.IsDelim('}') {
					key := string(in.String())
					in.WantColon()
					var v2 string
					v2 = string(in.String())
					(out.TagMap)[key] = v2
					in.WantComma()
				}
				in.Delim('}')
			}
		case "event":
			if in.IsNull() {
				in.Skip()
				out.Events = nil
			} else {
				in.Delim('[')
				if out.Events == nil {
					if !in.IsDelim(']') {
						out.Events = make([]string, 0, 4)
					} else {
						out.Events = []string{}
					}
				} else {
					out.Events = (out.Events)[:0]
				}
				for !in.IsDelim(']') {
					var v3 string
					v3 = string(in.String())
					out.Events = append(out.Events, v3)
					in.WantComma()
				}
				in.Delim(']')
			}
		case "rootName":
			out.RootName = string(in.String())
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjson6ff3ac1dEncodeGoSignozIoSignozPkgQueryServiceModel(out *jwriter.Writer, in SearchSpanResponseItem) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"timestamp\":"
		out.RawString(prefix[1:])
		out.Uint64(uint64(in.TimeUnixNano))
	}
	{
		const prefix string = ",\"durationNano\":"
		out.RawString(prefix)
		out.Int64(int64(in.DurationNano))
	}
	{
		const prefix string = ",\"spanId\":"
		out.RawString(prefix)
		out.String(string(in.SpanID))
	}
	{
		const prefix string = ",\"rootSpanId\":"
		out.RawString(prefix)
		out.String(string(in.RootSpanID))
	}
	{
		const prefix string = ",\"traceId\":"
		out.RawString(prefix)
		out.String(string(in.TraceID))
	}
	{
		const prefix string = ",\"hasError\":"
		out.RawString(prefix)
		out.Bool(bool(in.HasError))
	}
	{
		const prefix string = ",\"kind\":"
		out.RawString(prefix)
		out.Int32(int32(in.Kind))
	}
	{
		const prefix string = ",\"serviceName\":"
		out.RawString(prefix)
		out.String(string(in.ServiceName))
	}
	{
		const prefix string = ",\"name\":"
		out.RawString(prefix)
		out.String(string(in.Name))
	}
	if len(in.References) != 0 {
		const prefix string = ",\"references\":"
		out.RawString(prefix)
		{
			out.RawByte('[')
			for v4, v5 := range in.References {
				if v4 > 0 {
					out.RawByte(',')
				}
				easyjson6ff3ac1dEncodeGoSignozIoSignozPkgQueryServiceModel1(out, v5)
			}
			out.RawByte(']')
		}
	}
	{
		const prefix string = ",\"tagMap\":"
		out.RawString(prefix)
		if in.TagMap == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {
			out.RawString(`null`)
		} else {
			out.RawByte('{')
			v6First := true
			for v6Name, v6Value := range in.TagMap {
				if v6First {
					v6First = false
				} else {
					out.RawByte(',')
				}
				out.String(string(v6Name))
				out.RawByte(':')
				out.String(string(v6Value))
			}
			out.RawByte('}')
		}
	}
	{
		const prefix string = ",\"event\":"
		out.RawString(prefix)
		if in.Events == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
			out.RawString("null")
		} else {
			out.RawByte('[')
			for v7, v8 := range in.Events {
				if v7 > 0 {
					out.RawByte(',')
				}
				out.String(string(v8))
			}
			out.RawByte(']')
		}
	}
	{
		const prefix string = ",\"rootName\":"
		out.RawString(prefix)
		out.String(string(in.RootName))
	}
	out.RawByte('}')
}

// MarshalJSON supports json.Marshaler interface
func (v SearchSpanResponseItem) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjson6ff3ac1dEncodeGoSignozIoSignozPkgQueryServiceModel(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}

// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SearchSpanResponseItem) MarshalEasyJSON(w *jwriter.Writer) {
	easyjson6ff3ac1dEncodeGoSignozIoSignozPkgQueryServiceModel(w, v)
}

// UnmarshalJSON supports json.Unmarshaler interface
func (v *SearchSpanResponseItem) UnmarshalJSON(data []byte) error {
	r := jlexer.Lexer{Data: data}
	easyjson6ff3ac1dDecodeGoSignozIoSignozPkgQueryServiceModel(&r, v)
	return r.Error()
}

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SearchSpanResponseItem) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjson6ff3ac1dDecodeGoSignozIoSignozPkgQueryServiceModel(l, v)
}
func easyjson6ff3ac1dDecodeGoSignozIoSignozPkgQueryServiceModel1(in *jlexer.Lexer, out *OtelSpanRef) {
	isTopLevel := in.IsStart()
	if in.IsNull() {
		if isTopLevel {
			in.Consumed()
		}
		in.Skip()
		return
	}
	in.Delim('{')
	for !in.IsDelim('}') {
		key := in.UnsafeFieldName(false)
		in.WantColon()
		if in.IsNull() {
			in.Skip()
			in.WantComma()
			continue
		}
		switch key {
		case "traceId":
			out.TraceId = string(in.String())
		case "spanId":
			out.SpanId = string(in.String())
		case "refType":
			out.RefType = string(in.String())
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjson6ff3ac1dEncodeGoSignozIoSignozPkgQueryServiceModel1(out *jwriter.Writer, in OtelSpanRef) {
	out.RawByte('{')
	first := true
	_ = first
	if in.TraceId != "" {
		const prefix string = ",\"traceId\":"
		first = false
		out.RawString(prefix[1:])
		out.String(string(in.TraceId))
	}
	if in.SpanId != "" {
		const prefix string = ",\"spanId\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		out.String(string(in.SpanId))
	}
	if in.RefType != "" {
		const prefix string = ",\"refType\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		out.String(string(in.RefType))
	}
	out.RawByte('}')
}
