package grid

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

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

// DecodeMsg implements msgp.Decodable
func (z *testRequest) 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 "Num":
			z.Num, err = dc.ReadInt()
			if err != nil {
				err = msgp.WrapError(err, "Num")
				return
			}
		case "String":
			z.String, err = dc.ReadString()
			if err != nil {
				err = msgp.WrapError(err, "String")
				return
			}
		default:
			err = dc.Skip()
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	return
}

// EncodeMsg implements msgp.Encodable
func (z testRequest) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 2
	// write "Num"
	err = en.Append(0x82, 0xa3, 0x4e, 0x75, 0x6d)
	if err != nil {
		return
	}
	err = en.WriteInt(z.Num)
	if err != nil {
		err = msgp.WrapError(err, "Num")
		return
	}
	// write "String"
	err = en.Append(0xa6, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67)
	if err != nil {
		return
	}
	err = en.WriteString(z.String)
	if err != nil {
		err = msgp.WrapError(err, "String")
		return
	}
	return
}

// MarshalMsg implements msgp.Marshaler
func (z testRequest) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 2
	// string "Num"
	o = append(o, 0x82, 0xa3, 0x4e, 0x75, 0x6d)
	o = msgp.AppendInt(o, z.Num)
	// string "String"
	o = append(o, 0xa6, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67)
	o = msgp.AppendString(o, z.String)
	return
}

// UnmarshalMsg implements msgp.Unmarshaler
func (z *testRequest) UnmarshalMsg(bts []byte) (o []byte, err error) {
	var field []byte
	_ = field
	var zb0001 uint32
	zb0001, bts, err = msgp.ReadMapHeaderBytes(bts)
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	for zb0001 > 0 {
		zb0001--
		field, bts, err = msgp.ReadMapKeyZC(bts)
		if err != nil {
			err = msgp.WrapError(err)
			return
		}
		switch msgp.UnsafeString(field) {
		case "Num":
			z.Num, bts, err = msgp.ReadIntBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "Num")
				return
			}
		case "String":
			z.String, bts, err = msgp.ReadStringBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "String")
				return
			}
		default:
			bts, err = msgp.Skip(bts)
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	o = bts
	return
}

// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z testRequest) Msgsize() (s int) {
	s = 1 + 4 + msgp.IntSize + 7 + msgp.StringPrefixSize + len(z.String)
	return
}

// DecodeMsg implements msgp.Decodable
func (z *testResponse) 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 "OrgNum":
			z.OrgNum, err = dc.ReadInt()
			if err != nil {
				err = msgp.WrapError(err, "OrgNum")
				return
			}
		case "OrgString":
			z.OrgString, err = dc.ReadString()
			if err != nil {
				err = msgp.WrapError(err, "OrgString")
				return
			}
		case "Embedded":
			var zb0002 uint32
			zb0002, err = dc.ReadMapHeader()
			if err != nil {
				err = msgp.WrapError(err, "Embedded")
				return
			}
			for zb0002 > 0 {
				zb0002--
				field, err = dc.ReadMapKeyPtr()
				if err != nil {
					err = msgp.WrapError(err, "Embedded")
					return
				}
				switch msgp.UnsafeString(field) {
				case "Num":
					z.Embedded.Num, err = dc.ReadInt()
					if err != nil {
						err = msgp.WrapError(err, "Embedded", "Num")
						return
					}
				case "String":
					z.Embedded.String, err = dc.ReadString()
					if err != nil {
						err = msgp.WrapError(err, "Embedded", "String")
						return
					}
				default:
					err = dc.Skip()
					if err != nil {
						err = msgp.WrapError(err, "Embedded")
						return
					}
				}
			}
		default:
			err = dc.Skip()
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	return
}

// EncodeMsg implements msgp.Encodable
func (z *testResponse) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 3
	// write "OrgNum"
	err = en.Append(0x83, 0xa6, 0x4f, 0x72, 0x67, 0x4e, 0x75, 0x6d)
	if err != nil {
		return
	}
	err = en.WriteInt(z.OrgNum)
	if err != nil {
		err = msgp.WrapError(err, "OrgNum")
		return
	}
	// write "OrgString"
	err = en.Append(0xa9, 0x4f, 0x72, 0x67, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67)
	if err != nil {
		return
	}
	err = en.WriteString(z.OrgString)
	if err != nil {
		err = msgp.WrapError(err, "OrgString")
		return
	}
	// write "Embedded"
	err = en.Append(0xa8, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64)
	if err != nil {
		return
	}
	// map header, size 2
	// write "Num"
	err = en.Append(0x82, 0xa3, 0x4e, 0x75, 0x6d)
	if err != nil {
		return
	}
	err = en.WriteInt(z.Embedded.Num)
	if err != nil {
		err = msgp.WrapError(err, "Embedded", "Num")
		return
	}
	// write "String"
	err = en.Append(0xa6, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67)
	if err != nil {
		return
	}
	err = en.WriteString(z.Embedded.String)
	if err != nil {
		err = msgp.WrapError(err, "Embedded", "String")
		return
	}
	return
}

// MarshalMsg implements msgp.Marshaler
func (z *testResponse) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 3
	// string "OrgNum"
	o = append(o, 0x83, 0xa6, 0x4f, 0x72, 0x67, 0x4e, 0x75, 0x6d)
	o = msgp.AppendInt(o, z.OrgNum)
	// string "OrgString"
	o = append(o, 0xa9, 0x4f, 0x72, 0x67, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67)
	o = msgp.AppendString(o, z.OrgString)
	// string "Embedded"
	o = append(o, 0xa8, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64)
	// map header, size 2
	// string "Num"
	o = append(o, 0x82, 0xa3, 0x4e, 0x75, 0x6d)
	o = msgp.AppendInt(o, z.Embedded.Num)
	// string "String"
	o = append(o, 0xa6, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67)
	o = msgp.AppendString(o, z.Embedded.String)
	return
}

// UnmarshalMsg implements msgp.Unmarshaler
func (z *testResponse) UnmarshalMsg(bts []byte) (o []byte, err error) {
	var field []byte
	_ = field
	var zb0001 uint32
	zb0001, bts, err = msgp.ReadMapHeaderBytes(bts)
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	for zb0001 > 0 {
		zb0001--
		field, bts, err = msgp.ReadMapKeyZC(bts)
		if err != nil {
			err = msgp.WrapError(err)
			return
		}
		switch msgp.UnsafeString(field) {
		case "OrgNum":
			z.OrgNum, bts, err = msgp.ReadIntBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "OrgNum")
				return
			}
		case "OrgString":
			z.OrgString, bts, err = msgp.ReadStringBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "OrgString")
				return
			}
		case "Embedded":
			var zb0002 uint32
			zb0002, bts, err = msgp.ReadMapHeaderBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "Embedded")
				return
			}
			for zb0002 > 0 {
				zb0002--
				field, bts, err = msgp.ReadMapKeyZC(bts)
				if err != nil {
					err = msgp.WrapError(err, "Embedded")
					return
				}
				switch msgp.UnsafeString(field) {
				case "Num":
					z.Embedded.Num, bts, err = msgp.ReadIntBytes(bts)
					if err != nil {
						err = msgp.WrapError(err, "Embedded", "Num")
						return
					}
				case "String":
					z.Embedded.String, bts, err = msgp.ReadStringBytes(bts)
					if err != nil {
						err = msgp.WrapError(err, "Embedded", "String")
						return
					}
				default:
					bts, err = msgp.Skip(bts)
					if err != nil {
						err = msgp.WrapError(err, "Embedded")
						return
					}
				}
			}
		default:
			bts, err = msgp.Skip(bts)
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	o = bts
	return
}

// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z *testResponse) Msgsize() (s int) {
	s = 1 + 7 + msgp.IntSize + 10 + msgp.StringPrefixSize + len(z.OrgString) + 9 + 1 + 4 + msgp.IntSize + 7 + msgp.StringPrefixSize + len(z.Embedded.String)
	return
}
