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

package event

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

// DecodeMsg implements msgp.Decodable
func (z *TableIDStore) 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 "schema_to_tables":
			var zb0002 uint32
			zb0002, err = dc.ReadMapHeader()
			if err != nil {
				err = msgp.WrapError(err, "SchemaIDToTableIDs")
				return
			}
			if z.SchemaIDToTableIDs == nil {
				z.SchemaIDToTableIDs = make(map[int64]map[int64]interface{}, zb0002)
			} else if len(z.SchemaIDToTableIDs) > 0 {
				clear(z.SchemaIDToTableIDs)
			}
			for zb0002 > 0 {
				zb0002--
				var za0001 string
				za0001, err = dc.ReadString()
				if err != nil {
					err = msgp.WrapError(err, "SchemaIDToTableIDs")
					return
				}
				var za0002 map[int64]interface{}
				var zb0003 uint32
				zb0003, err = dc.ReadMapHeader()
				if err != nil {
					err = msgp.WrapError(err, "SchemaIDToTableIDs", za0001)
					return
				}
				if za0002 == nil {
					za0002 = make(map[int64]interface{}, zb0003)
				} else if len(za0002) > 0 {
					clear(za0002)
				}
				for zb0003 > 0 {
					zb0003--
					var za0003 string
					za0003, err = dc.ReadString()
					if err != nil {
						err = msgp.WrapError(err, "SchemaIDToTableIDs", za0001)
						return
					}
					var za0004 interface{}
					za0004, err = dc.ReadIntf()
					if err != nil {
						err = msgp.WrapError(err, "SchemaIDToTableIDs", za0001, za0003)
						return
					}
					var za0003Tmp int64
					za0003Tmp, err = msgp.AutoShim{}.ParseInt64(za0003)
					if err != nil {
						err = msgp.WrapError(err, "shim: za0002")
						return
					}
					za0002[int64(za0003Tmp)] = za0004
				}
				var za0001Tmp int64
				za0001Tmp, err = msgp.AutoShim{}.ParseInt64(za0001)
				if err != nil {
					err = msgp.WrapError(err, "shim: z.SchemaIDToTableIDs")
					return
				}
				z.SchemaIDToTableIDs[int64(za0001Tmp)] = za0002
			}
		case "table_to_schema":
			var zb0004 uint32
			zb0004, err = dc.ReadMapHeader()
			if err != nil {
				err = msgp.WrapError(err, "TableIDToSchemaID")
				return
			}
			if z.TableIDToSchemaID == nil {
				z.TableIDToSchemaID = make(map[int64]int64, zb0004)
			} else if len(z.TableIDToSchemaID) > 0 {
				clear(z.TableIDToSchemaID)
			}
			for zb0004 > 0 {
				zb0004--
				var za0005 string
				za0005, err = dc.ReadString()
				if err != nil {
					err = msgp.WrapError(err, "TableIDToSchemaID")
					return
				}
				var za0006 int64
				za0006, err = dc.ReadInt64()
				if err != nil {
					err = msgp.WrapError(err, "TableIDToSchemaID", za0005)
					return
				}
				var za0005Tmp int64
				za0005Tmp, err = msgp.AutoShim{}.ParseInt64(za0005)
				if err != nil {
					err = msgp.WrapError(err, "shim: z.TableIDToSchemaID")
					return
				}
				z.TableIDToSchemaID[int64(za0005Tmp)] = za0006
			}
		default:
			err = dc.Skip()
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	return
}

// EncodeMsg implements msgp.Encodable
func (z *TableIDStore) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 2
	// write "schema_to_tables"
	err = en.Append(0x82, 0xb0, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x74, 0x6f, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x73)
	if err != nil {
		return
	}
	err = en.WriteMapHeader(uint32(len(z.SchemaIDToTableIDs)))
	if err != nil {
		err = msgp.WrapError(err, "SchemaIDToTableIDs")
		return
	}
	for za0001, za0002 := range z.SchemaIDToTableIDs {
		err = en.WriteString(msgp.AutoShim{}.Int64String(int64(za0001)))
		if err != nil {
			err = msgp.WrapError(err, "SchemaIDToTableIDs")
			return
		}
		err = en.WriteMapHeader(uint32(len(za0002)))
		if err != nil {
			err = msgp.WrapError(err, "SchemaIDToTableIDs", za0001)
			return
		}
		for za0003, za0004 := range za0002 {
			err = en.WriteString(msgp.AutoShim{}.Int64String(int64(za0003)))
			if err != nil {
				err = msgp.WrapError(err, "SchemaIDToTableIDs", za0001)
				return
			}
			err = en.WriteIntf(za0004)
			if err != nil {
				err = msgp.WrapError(err, "SchemaIDToTableIDs", za0001, za0003)
				return
			}
		}
	}
	// write "table_to_schema"
	err = en.Append(0xaf, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x74, 0x6f, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61)
	if err != nil {
		return
	}
	err = en.WriteMapHeader(uint32(len(z.TableIDToSchemaID)))
	if err != nil {
		err = msgp.WrapError(err, "TableIDToSchemaID")
		return
	}
	for za0005, za0006 := range z.TableIDToSchemaID {
		err = en.WriteString(msgp.AutoShim{}.Int64String(int64(za0005)))
		if err != nil {
			err = msgp.WrapError(err, "TableIDToSchemaID")
			return
		}
		err = en.WriteInt64(za0006)
		if err != nil {
			err = msgp.WrapError(err, "TableIDToSchemaID", za0005)
			return
		}
	}
	return
}

// MarshalMsg implements msgp.Marshaler
func (z *TableIDStore) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 2
	// string "schema_to_tables"
	o = append(o, 0x82, 0xb0, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x74, 0x6f, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x73)
	o = msgp.AppendMapHeader(o, uint32(len(z.SchemaIDToTableIDs)))
	for za0001, za0002 := range z.SchemaIDToTableIDs {
		o = msgp.AppendString(o, msgp.AutoShim{}.Int64String(int64(za0001)))
		o = msgp.AppendMapHeader(o, uint32(len(za0002)))
		for za0003, za0004 := range za0002 {
			o = msgp.AppendString(o, msgp.AutoShim{}.Int64String(int64(za0003)))
			o, err = msgp.AppendIntf(o, za0004)
			if err != nil {
				err = msgp.WrapError(err, "SchemaIDToTableIDs", za0001, za0003)
				return
			}
		}
	}
	// string "table_to_schema"
	o = append(o, 0xaf, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x74, 0x6f, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61)
	o = msgp.AppendMapHeader(o, uint32(len(z.TableIDToSchemaID)))
	for za0005, za0006 := range z.TableIDToSchemaID {
		o = msgp.AppendString(o, msgp.AutoShim{}.Int64String(int64(za0005)))
		o = msgp.AppendInt64(o, za0006)
	}
	return
}

// UnmarshalMsg implements msgp.Unmarshaler
func (z *TableIDStore) 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 "schema_to_tables":
			var zb0002 uint32
			zb0002, bts, err = msgp.ReadMapHeaderBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "SchemaIDToTableIDs")
				return
			}
			if z.SchemaIDToTableIDs == nil {
				z.SchemaIDToTableIDs = make(map[int64]map[int64]interface{}, zb0002)
			} else if len(z.SchemaIDToTableIDs) > 0 {
				clear(z.SchemaIDToTableIDs)
			}
			for zb0002 > 0 {
				var za0002 map[int64]interface{}
				zb0002--
				var za0001 string
				za0001, bts, err = msgp.ReadStringBytes(bts)
				if err != nil {
					err = msgp.WrapError(err, "SchemaIDToTableIDs")
					return
				}
				var zb0003 uint32
				zb0003, bts, err = msgp.ReadMapHeaderBytes(bts)
				if err != nil {
					err = msgp.WrapError(err, "SchemaIDToTableIDs", za0001)
					return
				}
				if za0002 == nil {
					za0002 = make(map[int64]interface{}, zb0003)
				} else if len(za0002) > 0 {
					clear(za0002)
				}
				for zb0003 > 0 {
					var za0004 interface{}
					zb0003--
					var za0003 string
					za0003, bts, err = msgp.ReadStringBytes(bts)
					if err != nil {
						err = msgp.WrapError(err, "SchemaIDToTableIDs", za0001)
						return
					}
					za0004, bts, err = msgp.ReadIntfBytes(bts)
					if err != nil {
						err = msgp.WrapError(err, "SchemaIDToTableIDs", za0001, za0003)
						return
					}
					var za0003Tmp int64
					za0003Tmp, err = msgp.AutoShim{}.ParseInt64(za0003)
					if err != nil {
						err = msgp.WrapError(err, "shim: za0002")
						return
					}
					za0002[int64(za0003Tmp)] = za0004
				}
				var za0001Tmp int64
				za0001Tmp, err = msgp.AutoShim{}.ParseInt64(za0001)
				if err != nil {
					err = msgp.WrapError(err, "shim: z.SchemaIDToTableIDs")
					return
				}
				z.SchemaIDToTableIDs[int64(za0001Tmp)] = za0002
			}
		case "table_to_schema":
			var zb0004 uint32
			zb0004, bts, err = msgp.ReadMapHeaderBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "TableIDToSchemaID")
				return
			}
			if z.TableIDToSchemaID == nil {
				z.TableIDToSchemaID = make(map[int64]int64, zb0004)
			} else if len(z.TableIDToSchemaID) > 0 {
				clear(z.TableIDToSchemaID)
			}
			for zb0004 > 0 {
				var za0006 int64
				zb0004--
				var za0005 string
				za0005, bts, err = msgp.ReadStringBytes(bts)
				if err != nil {
					err = msgp.WrapError(err, "TableIDToSchemaID")
					return
				}
				za0006, bts, err = msgp.ReadInt64Bytes(bts)
				if err != nil {
					err = msgp.WrapError(err, "TableIDToSchemaID", za0005)
					return
				}
				var za0005Tmp int64
				za0005Tmp, err = msgp.AutoShim{}.ParseInt64(za0005)
				if err != nil {
					err = msgp.WrapError(err, "shim: z.TableIDToSchemaID")
					return
				}
				z.TableIDToSchemaID[int64(za0005Tmp)] = za0006
			}
		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 *TableIDStore) Msgsize() (s int) {
	s = 1 + 17 + msgp.MapHeaderSize
	if z.SchemaIDToTableIDs != nil {
		for za0001, za0002 := range z.SchemaIDToTableIDs {
			_ = za0002
			_ = za0001
			s += msgp.Int64Size + msgp.MapHeaderSize
			if za0002 != nil {
				for za0003, za0004 := range za0002 {
					_ = za0004
					_ = za0003
					s += msgp.Int64Size + msgp.GuessSize(za0004)
				}
			}
		}
	}
	s += 16 + msgp.MapHeaderSize
	if z.TableIDToSchemaID != nil {
		for za0005, za0006 := range z.TableIDToSchemaID {
			_ = za0006
			_ = za0005
			s += msgp.Int64Size + msgp.Int64Size
		}
	}
	return
}

// DecodeMsg implements msgp.Decodable
func (z *TableSchemaStore) 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 "table_id_store":
			if dc.IsNil() {
				err = dc.ReadNil()
				if err != nil {
					err = msgp.WrapError(err, "TableIDStore")
					return
				}
				z.TableIDStore = nil
			} else {
				if z.TableIDStore == nil {
					z.TableIDStore = new(TableIDStore)
				}
				err = z.TableIDStore.DecodeMsg(dc)
				if err != nil {
					err = msgp.WrapError(err, "TableIDStore")
					return
				}
			}
		default:
			err = dc.Skip()
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	return
}

// EncodeMsg implements msgp.Encodable
func (z *TableSchemaStore) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 1
	// write "table_id_store"
	err = en.Append(0x81, 0xae, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65)
	if err != nil {
		return
	}
	if z.TableIDStore == nil {
		err = en.WriteNil()
		if err != nil {
			return
		}
	} else {
		err = z.TableIDStore.EncodeMsg(en)
		if err != nil {
			err = msgp.WrapError(err, "TableIDStore")
			return
		}
	}
	return
}

// MarshalMsg implements msgp.Marshaler
func (z *TableSchemaStore) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 1
	// string "table_id_store"
	o = append(o, 0x81, 0xae, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65)
	if z.TableIDStore == nil {
		o = msgp.AppendNil(o)
	} else {
		o, err = z.TableIDStore.MarshalMsg(o)
		if err != nil {
			err = msgp.WrapError(err, "TableIDStore")
			return
		}
	}
	return
}

// UnmarshalMsg implements msgp.Unmarshaler
func (z *TableSchemaStore) 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 "table_id_store":
			if msgp.IsNil(bts) {
				bts, err = msgp.ReadNilBytes(bts)
				if err != nil {
					return
				}
				z.TableIDStore = nil
			} else {
				if z.TableIDStore == nil {
					z.TableIDStore = new(TableIDStore)
				}
				bts, err = z.TableIDStore.UnmarshalMsg(bts)
				if err != nil {
					err = msgp.WrapError(err, "TableIDStore")
					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 *TableSchemaStore) Msgsize() (s int) {
	s = 1 + 15
	if z.TableIDStore == nil {
		s += msgp.NilSize
	} else {
		s += z.TableIDStore.Msgsize()
	}
	return
}
