// Code generated by github.com/tinylib/msgp DO NOT EDIT.

package tracer

import (
	"github.com/tinylib/msgp/msgp"
)

// DecodeMsg implements msgp.Decodable
func (z *spanEvent) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var zb0001 uint32
	zb0001, err = dc.ReadMapHeader()
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	for zb0001 > 0 {
		zb0001--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			err = msgp.WrapError(err)
			return
		}
		switch msgp.UnsafeString(field) {
		case "name":
			z.Name, err = dc.ReadString()
			if err != nil {
				err = msgp.WrapError(err, "Name")
				return
			}
		case "time_unix_nano":
			z.TimeUnixNano, err = dc.ReadUint64()
			if err != nil {
				err = msgp.WrapError(err, "TimeUnixNano")
				return
			}
		case "attributes":
			var zb0002 uint32
			zb0002, err = dc.ReadMapHeader()
			if err != nil {
				err = msgp.WrapError(err, "Attributes")
				return
			}
			if z.Attributes == nil {
				z.Attributes = make(map[string]*spanEventAttribute, zb0002)
			} else if len(z.Attributes) > 0 {
				clear(z.Attributes)
			}
			for zb0002 > 0 {
				zb0002--
				var za0001 string
				za0001, err = dc.ReadString()
				if err != nil {
					err = msgp.WrapError(err, "Attributes")
					return
				}
				var za0002 *spanEventAttribute
				if dc.IsNil() {
					err = dc.ReadNil()
					if err != nil {
						err = msgp.WrapError(err, "Attributes", za0001)
						return
					}
					za0002 = nil
				} else {
					if za0002 == nil {
						za0002 = new(spanEventAttribute)
					}
					err = za0002.DecodeMsg(dc)
					if err != nil {
						err = msgp.WrapError(err, "Attributes", za0001)
						return
					}
				}
				z.Attributes[za0001] = za0002
			}
		default:
			err = dc.Skip()
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	return
}

// EncodeMsg implements msgp.Encodable
func (z *spanEvent) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 3
	// write "name"
	err = en.Append(0x83, 0xa4, 0x6e, 0x61, 0x6d, 0x65)
	if err != nil {
		return
	}
	err = en.WriteString(z.Name)
	if err != nil {
		err = msgp.WrapError(err, "Name")
		return
	}
	// write "time_unix_nano"
	err = en.Append(0xae, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x78, 0x5f, 0x6e, 0x61, 0x6e, 0x6f)
	if err != nil {
		return
	}
	err = en.WriteUint64(z.TimeUnixNano)
	if err != nil {
		err = msgp.WrapError(err, "TimeUnixNano")
		return
	}
	// write "attributes"
	err = en.Append(0xaa, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73)
	if err != nil {
		return
	}
	err = en.WriteMapHeader(uint32(len(z.Attributes)))
	if err != nil {
		err = msgp.WrapError(err, "Attributes")
		return
	}
	for za0001, za0002 := range z.Attributes {
		err = en.WriteString(za0001)
		if err != nil {
			err = msgp.WrapError(err, "Attributes")
			return
		}
		if za0002 == nil {
			err = en.WriteNil()
			if err != nil {
				return
			}
		} else {
			err = za0002.EncodeMsg(en)
			if err != nil {
				err = msgp.WrapError(err, "Attributes", za0001)
				return
			}
		}
	}
	return
}

// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z *spanEvent) Msgsize() (s int) {
	s = 1 + 5 + msgp.StringPrefixSize + len(z.Name) + 15 + msgp.Uint64Size + 11 + msgp.MapHeaderSize
	if z.Attributes != nil {
		for za0001, za0002 := range z.Attributes {
			_ = za0002
			s += msgp.StringPrefixSize + len(za0001)
			if za0002 == nil {
				s += msgp.NilSize
			} else {
				s += za0002.Msgsize()
			}
		}
	}
	return
}

// DecodeMsg implements msgp.Decodable
func (z *spanEventArrayAttribute) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var zb0001 uint32
	zb0001, err = dc.ReadMapHeader()
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	for zb0001 > 0 {
		zb0001--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			err = msgp.WrapError(err)
			return
		}
		switch msgp.UnsafeString(field) {
		case "values":
			var zb0002 uint32
			zb0002, err = dc.ReadArrayHeader()
			if err != nil {
				err = msgp.WrapError(err, "Values")
				return
			}
			if cap(z.Values) >= int(zb0002) {
				z.Values = (z.Values)[:zb0002]
			} else {
				z.Values = make([]*spanEventArrayAttributeValue, zb0002)
			}
			for za0001 := range z.Values {
				if dc.IsNil() {
					err = dc.ReadNil()
					if err != nil {
						err = msgp.WrapError(err, "Values", za0001)
						return
					}
					z.Values[za0001] = nil
				} else {
					if z.Values[za0001] == nil {
						z.Values[za0001] = new(spanEventArrayAttributeValue)
					}
					err = z.Values[za0001].DecodeMsg(dc)
					if err != nil {
						err = msgp.WrapError(err, "Values", za0001)
						return
					}
				}
			}
		default:
			err = dc.Skip()
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	return
}

// EncodeMsg implements msgp.Encodable
func (z *spanEventArrayAttribute) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 1
	// write "values"
	err = en.Append(0x81, 0xa6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73)
	if err != nil {
		return
	}
	err = en.WriteArrayHeader(uint32(len(z.Values)))
	if err != nil {
		err = msgp.WrapError(err, "Values")
		return
	}
	for za0001 := range z.Values {
		if z.Values[za0001] == nil {
			err = en.WriteNil()
			if err != nil {
				return
			}
		} else {
			err = z.Values[za0001].EncodeMsg(en)
			if err != nil {
				err = msgp.WrapError(err, "Values", za0001)
				return
			}
		}
	}
	return
}

// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z *spanEventArrayAttribute) Msgsize() (s int) {
	s = 1 + 7 + msgp.ArrayHeaderSize
	for za0001 := range z.Values {
		if z.Values[za0001] == nil {
			s += msgp.NilSize
		} else {
			s += z.Values[za0001].Msgsize()
		}
	}
	return
}

// DecodeMsg implements msgp.Decodable
func (z *spanEventArrayAttributeValue) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var zb0001 uint32
	zb0001, err = dc.ReadMapHeader()
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	for zb0001 > 0 {
		zb0001--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			err = msgp.WrapError(err)
			return
		}
		switch msgp.UnsafeString(field) {
		case "type":
			{
				var zb0002 int32
				zb0002, err = dc.ReadInt32()
				if err != nil {
					err = msgp.WrapError(err, "Type")
					return
				}
				z.Type = spanEventArrayAttributeValueType(zb0002)
			}
		case "string_value":
			z.StringValue, err = dc.ReadString()
			if err != nil {
				err = msgp.WrapError(err, "StringValue")
				return
			}
		case "bool_value":
			z.BoolValue, err = dc.ReadBool()
			if err != nil {
				err = msgp.WrapError(err, "BoolValue")
				return
			}
		case "int_value":
			z.IntValue, err = dc.ReadInt64()
			if err != nil {
				err = msgp.WrapError(err, "IntValue")
				return
			}
		case "double_value":
			z.DoubleValue, err = dc.ReadFloat64()
			if err != nil {
				err = msgp.WrapError(err, "DoubleValue")
				return
			}
		default:
			err = dc.Skip()
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	return
}

// EncodeMsg implements msgp.Encodable
func (z *spanEventArrayAttributeValue) EncodeMsg(en *msgp.Writer) (err error) {
	// check for omitted fields
	zb0001Len := uint32(5)
	var zb0001Mask uint8 /* 5 bits */
	_ = zb0001Mask
	if z.StringValue == "" {
		zb0001Len--
		zb0001Mask |= 0x2
	}
	if z.BoolValue == false {
		zb0001Len--
		zb0001Mask |= 0x4
	}
	if z.IntValue == 0 {
		zb0001Len--
		zb0001Mask |= 0x8
	}
	if z.DoubleValue == 0 {
		zb0001Len--
		zb0001Mask |= 0x10
	}
	// variable map header, size zb0001Len
	err = en.Append(0x80 | uint8(zb0001Len))
	if err != nil {
		return
	}

	// skip if no fields are to be emitted
	if zb0001Len != 0 {
		// write "type"
		err = en.Append(0xa4, 0x74, 0x79, 0x70, 0x65)
		if err != nil {
			return
		}
		err = en.WriteInt32(int32(z.Type))
		if err != nil {
			err = msgp.WrapError(err, "Type")
			return
		}
		if (zb0001Mask & 0x2) == 0 { // if not omitted
			// write "string_value"
			err = en.Append(0xac, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65)
			if err != nil {
				return
			}
			err = en.WriteString(z.StringValue)
			if err != nil {
				err = msgp.WrapError(err, "StringValue")
				return
			}
		}
		if (zb0001Mask & 0x4) == 0 { // if not omitted
			// write "bool_value"
			err = en.Append(0xaa, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65)
			if err != nil {
				return
			}
			err = en.WriteBool(z.BoolValue)
			if err != nil {
				err = msgp.WrapError(err, "BoolValue")
				return
			}
		}
		if (zb0001Mask & 0x8) == 0 { // if not omitted
			// write "int_value"
			err = en.Append(0xa9, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65)
			if err != nil {
				return
			}
			err = en.WriteInt64(z.IntValue)
			if err != nil {
				err = msgp.WrapError(err, "IntValue")
				return
			}
		}
		if (zb0001Mask & 0x10) == 0 { // if not omitted
			// write "double_value"
			err = en.Append(0xac, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65)
			if err != nil {
				return
			}
			err = en.WriteFloat64(z.DoubleValue)
			if err != nil {
				err = msgp.WrapError(err, "DoubleValue")
				return
			}
		}
	}
	return
}

// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z *spanEventArrayAttributeValue) Msgsize() (s int) {
	s = 1 + 5 + msgp.Int32Size + 13 + msgp.StringPrefixSize + len(z.StringValue) + 11 + msgp.BoolSize + 10 + msgp.Int64Size + 13 + msgp.Float64Size
	return
}

// DecodeMsg implements msgp.Decodable
func (z *spanEventArrayAttributeValueType) DecodeMsg(dc *msgp.Reader) (err error) {
	{
		var zb0001 int32
		zb0001, err = dc.ReadInt32()
		if err != nil {
			err = msgp.WrapError(err)
			return
		}
		(*z) = spanEventArrayAttributeValueType(zb0001)
	}
	return
}

// EncodeMsg implements msgp.Encodable
func (z spanEventArrayAttributeValueType) EncodeMsg(en *msgp.Writer) (err error) {
	err = en.WriteInt32(int32(z))
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	return
}

// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z spanEventArrayAttributeValueType) Msgsize() (s int) {
	s = msgp.Int32Size
	return
}

// DecodeMsg implements msgp.Decodable
func (z *spanEventAttribute) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var zb0001 uint32
	zb0001, err = dc.ReadMapHeader()
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	for zb0001 > 0 {
		zb0001--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			err = msgp.WrapError(err)
			return
		}
		switch msgp.UnsafeString(field) {
		case "type":
			{
				var zb0002 int32
				zb0002, err = dc.ReadInt32()
				if err != nil {
					err = msgp.WrapError(err, "Type")
					return
				}
				z.Type = spanEventAttributeType(zb0002)
			}
		case "string_value":
			z.StringValue, err = dc.ReadString()
			if err != nil {
				err = msgp.WrapError(err, "StringValue")
				return
			}
		case "bool_value":
			z.BoolValue, err = dc.ReadBool()
			if err != nil {
				err = msgp.WrapError(err, "BoolValue")
				return
			}
		case "int_value":
			z.IntValue, err = dc.ReadInt64()
			if err != nil {
				err = msgp.WrapError(err, "IntValue")
				return
			}
		case "double_value":
			z.DoubleValue, err = dc.ReadFloat64()
			if err != nil {
				err = msgp.WrapError(err, "DoubleValue")
				return
			}
		case "array_value":
			if dc.IsNil() {
				err = dc.ReadNil()
				if err != nil {
					err = msgp.WrapError(err, "ArrayValue")
					return
				}
				z.ArrayValue = nil
			} else {
				if z.ArrayValue == nil {
					z.ArrayValue = new(spanEventArrayAttribute)
				}
				var zb0003 uint32
				zb0003, err = dc.ReadMapHeader()
				if err != nil {
					err = msgp.WrapError(err, "ArrayValue")
					return
				}
				for zb0003 > 0 {
					zb0003--
					field, err = dc.ReadMapKeyPtr()
					if err != nil {
						err = msgp.WrapError(err, "ArrayValue")
						return
					}
					switch msgp.UnsafeString(field) {
					case "values":
						var zb0004 uint32
						zb0004, err = dc.ReadArrayHeader()
						if err != nil {
							err = msgp.WrapError(err, "ArrayValue", "Values")
							return
						}
						if cap(z.ArrayValue.Values) >= int(zb0004) {
							z.ArrayValue.Values = (z.ArrayValue.Values)[:zb0004]
						} else {
							z.ArrayValue.Values = make([]*spanEventArrayAttributeValue, zb0004)
						}
						for za0001 := range z.ArrayValue.Values {
							if dc.IsNil() {
								err = dc.ReadNil()
								if err != nil {
									err = msgp.WrapError(err, "ArrayValue", "Values", za0001)
									return
								}
								z.ArrayValue.Values[za0001] = nil
							} else {
								if z.ArrayValue.Values[za0001] == nil {
									z.ArrayValue.Values[za0001] = new(spanEventArrayAttributeValue)
								}
								err = z.ArrayValue.Values[za0001].DecodeMsg(dc)
								if err != nil {
									err = msgp.WrapError(err, "ArrayValue", "Values", za0001)
									return
								}
							}
						}
					default:
						err = dc.Skip()
						if err != nil {
							err = msgp.WrapError(err, "ArrayValue")
							return
						}
					}
				}
			}
		default:
			err = dc.Skip()
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	return
}

// EncodeMsg implements msgp.Encodable
func (z *spanEventAttribute) EncodeMsg(en *msgp.Writer) (err error) {
	// check for omitted fields
	zb0001Len := uint32(6)
	var zb0001Mask uint8 /* 6 bits */
	_ = zb0001Mask
	if z.StringValue == "" {
		zb0001Len--
		zb0001Mask |= 0x2
	}
	if z.BoolValue == false {
		zb0001Len--
		zb0001Mask |= 0x4
	}
	if z.IntValue == 0 {
		zb0001Len--
		zb0001Mask |= 0x8
	}
	if z.DoubleValue == 0 {
		zb0001Len--
		zb0001Mask |= 0x10
	}
	if z.ArrayValue == nil {
		zb0001Len--
		zb0001Mask |= 0x20
	}
	// variable map header, size zb0001Len
	err = en.Append(0x80 | uint8(zb0001Len))
	if err != nil {
		return
	}

	// skip if no fields are to be emitted
	if zb0001Len != 0 {
		// write "type"
		err = en.Append(0xa4, 0x74, 0x79, 0x70, 0x65)
		if err != nil {
			return
		}
		err = en.WriteInt32(int32(z.Type))
		if err != nil {
			err = msgp.WrapError(err, "Type")
			return
		}
		if (zb0001Mask & 0x2) == 0 { // if not omitted
			// write "string_value"
			err = en.Append(0xac, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65)
			if err != nil {
				return
			}
			err = en.WriteString(z.StringValue)
			if err != nil {
				err = msgp.WrapError(err, "StringValue")
				return
			}
		}
		if (zb0001Mask & 0x4) == 0 { // if not omitted
			// write "bool_value"
			err = en.Append(0xaa, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65)
			if err != nil {
				return
			}
			err = en.WriteBool(z.BoolValue)
			if err != nil {
				err = msgp.WrapError(err, "BoolValue")
				return
			}
		}
		if (zb0001Mask & 0x8) == 0 { // if not omitted
			// write "int_value"
			err = en.Append(0xa9, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65)
			if err != nil {
				return
			}
			err = en.WriteInt64(z.IntValue)
			if err != nil {
				err = msgp.WrapError(err, "IntValue")
				return
			}
		}
		if (zb0001Mask & 0x10) == 0 { // if not omitted
			// write "double_value"
			err = en.Append(0xac, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65)
			if err != nil {
				return
			}
			err = en.WriteFloat64(z.DoubleValue)
			if err != nil {
				err = msgp.WrapError(err, "DoubleValue")
				return
			}
		}
		if (zb0001Mask & 0x20) == 0 { // if not omitted
			// write "array_value"
			err = en.Append(0xab, 0x61, 0x72, 0x72, 0x61, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65)
			if err != nil {
				return
			}
			if z.ArrayValue == nil {
				err = en.WriteNil()
				if err != nil {
					return
				}
			} else {
				// map header, size 1
				// write "values"
				err = en.Append(0x81, 0xa6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73)
				if err != nil {
					return
				}
				err = en.WriteArrayHeader(uint32(len(z.ArrayValue.Values)))
				if err != nil {
					err = msgp.WrapError(err, "ArrayValue", "Values")
					return
				}
				for za0001 := range z.ArrayValue.Values {
					if z.ArrayValue.Values[za0001] == nil {
						err = en.WriteNil()
						if err != nil {
							return
						}
					} else {
						err = z.ArrayValue.Values[za0001].EncodeMsg(en)
						if err != nil {
							err = msgp.WrapError(err, "ArrayValue", "Values", za0001)
							return
						}
					}
				}
			}
		}
	}
	return
}

// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z *spanEventAttribute) Msgsize() (s int) {
	s = 1 + 5 + msgp.Int32Size + 13 + msgp.StringPrefixSize + len(z.StringValue) + 11 + msgp.BoolSize + 10 + msgp.Int64Size + 13 + msgp.Float64Size + 12
	if z.ArrayValue == nil {
		s += msgp.NilSize
	} else {
		s += 1 + 7 + msgp.ArrayHeaderSize
		for za0001 := range z.ArrayValue.Values {
			if z.ArrayValue.Values[za0001] == nil {
				s += msgp.NilSize
			} else {
				s += z.ArrayValue.Values[za0001].Msgsize()
			}
		}
	}
	return
}

// DecodeMsg implements msgp.Decodable
func (z *spanEventAttributeType) DecodeMsg(dc *msgp.Reader) (err error) {
	{
		var zb0001 int32
		zb0001, err = dc.ReadInt32()
		if err != nil {
			err = msgp.WrapError(err)
			return
		}
		(*z) = spanEventAttributeType(zb0001)
	}
	return
}

// EncodeMsg implements msgp.Encodable
func (z spanEventAttributeType) EncodeMsg(en *msgp.Writer) (err error) {
	err = en.WriteInt32(int32(z))
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	return
}

// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z spanEventAttributeType) Msgsize() (s int) {
	s = msgp.Int32Size
	return
}
