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

package fiber

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

// Size limits for msgp deserialization
const (
	zc920acdalimitArrays = 256
	zc920acdalimitMaps   = 32
)

// DecodeMsg implements msgp.Decodable
func (z *redirectionMsg) 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
	}
	if zb0001 > zc920acdalimitMaps {
		err = msgp.ErrLimitExceeded
		return
	}
	for zb0001 > 0 {
		zb0001--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			err = msgp.WrapError(err)
			return
		}
		switch msgp.UnsafeString(field) {
		case "key":
			z.key, err = dc.ReadString()
			if err != nil {
				err = msgp.WrapError(err, "key")
				return
			}
		case "value":
			z.value, err = dc.ReadString()
			if err != nil {
				err = msgp.WrapError(err, "value")
				return
			}
		case "level":
			z.level, err = dc.ReadUint8()
			if err != nil {
				err = msgp.WrapError(err, "level")
				return
			}
		case "isOldInput":
			z.isOldInput, err = dc.ReadBool()
			if err != nil {
				err = msgp.WrapError(err, "isOldInput")
				return
			}
		default:
			err = dc.Skip()
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	return
}

// EncodeMsg implements msgp.Encodable
func (z *redirectionMsg) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 4
	// write "key"
	err = en.Append(0x84, 0xa3, 0x6b, 0x65, 0x79)
	if err != nil {
		return
	}
	err = en.WriteString(z.key)
	if err != nil {
		err = msgp.WrapError(err, "key")
		return
	}
	// write "value"
	err = en.Append(0xa5, 0x76, 0x61, 0x6c, 0x75, 0x65)
	if err != nil {
		return
	}
	err = en.WriteString(z.value)
	if err != nil {
		err = msgp.WrapError(err, "value")
		return
	}
	// write "level"
	err = en.Append(0xa5, 0x6c, 0x65, 0x76, 0x65, 0x6c)
	if err != nil {
		return
	}
	err = en.WriteUint8(z.level)
	if err != nil {
		err = msgp.WrapError(err, "level")
		return
	}
	// write "isOldInput"
	err = en.Append(0xaa, 0x69, 0x73, 0x4f, 0x6c, 0x64, 0x49, 0x6e, 0x70, 0x75, 0x74)
	if err != nil {
		return
	}
	err = en.WriteBool(z.isOldInput)
	if err != nil {
		err = msgp.WrapError(err, "isOldInput")
		return
	}
	return
}

// MarshalMsg implements msgp.Marshaler
func (z *redirectionMsg) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 4
	// string "key"
	o = append(o, 0x84, 0xa3, 0x6b, 0x65, 0x79)
	o = msgp.AppendString(o, z.key)
	// string "value"
	o = append(o, 0xa5, 0x76, 0x61, 0x6c, 0x75, 0x65)
	o = msgp.AppendString(o, z.value)
	// string "level"
	o = append(o, 0xa5, 0x6c, 0x65, 0x76, 0x65, 0x6c)
	o = msgp.AppendUint8(o, z.level)
	// string "isOldInput"
	o = append(o, 0xaa, 0x69, 0x73, 0x4f, 0x6c, 0x64, 0x49, 0x6e, 0x70, 0x75, 0x74)
	o = msgp.AppendBool(o, z.isOldInput)
	return
}

// UnmarshalMsg implements msgp.Unmarshaler
func (z *redirectionMsg) 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
	}
	if zb0001 > zc920acdalimitMaps {
		err = msgp.ErrLimitExceeded
		return
	}
	for zb0001 > 0 {
		zb0001--
		field, bts, err = msgp.ReadMapKeyZC(bts)
		if err != nil {
			err = msgp.WrapError(err)
			return
		}
		switch msgp.UnsafeString(field) {
		case "key":
			z.key, bts, err = msgp.ReadStringBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "key")
				return
			}
		case "value":
			z.value, bts, err = msgp.ReadStringBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "value")
				return
			}
		case "level":
			z.level, bts, err = msgp.ReadUint8Bytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "level")
				return
			}
		case "isOldInput":
			z.isOldInput, bts, err = msgp.ReadBoolBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "isOldInput")
				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 *redirectionMsg) Msgsize() (s int) {
	s = 1 + 4 + msgp.StringPrefixSize + len(z.key) + 6 + msgp.StringPrefixSize + len(z.value) + 6 + msgp.Uint8Size + 11 + msgp.BoolSize
	return
}

// DecodeMsg implements msgp.Decodable
func (z *redirectionMsgs) DecodeMsg(dc *msgp.Reader) (err error) {
	var zb0002 uint32
	zb0002, err = dc.ReadArrayHeader()
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	if zb0002 > zc920acdalimitArrays {
		err = msgp.ErrLimitExceeded
		return
	}
	if cap((*z)) >= int(zb0002) {
		(*z) = (*z)[:zb0002]
	} else {
		(*z) = make(redirectionMsgs, zb0002)
	}
	for zb0001 := range *z {
		err = (*z)[zb0001].DecodeMsg(dc)
		if err != nil {
			err = msgp.WrapError(err, zb0001)
			return
		}
	}
	return
}

// EncodeMsg implements msgp.Encodable
func (z redirectionMsgs) EncodeMsg(en *msgp.Writer) (err error) {
	err = en.WriteArrayHeader(uint32(len(z)))
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	if uint32(len(z)) > zc920acdalimitArrays {
		err = msgp.ErrLimitExceeded
		return
	}
	for zb0003 := range z {
		err = z[zb0003].EncodeMsg(en)
		if err != nil {
			err = msgp.WrapError(err, zb0003)
			return
		}
	}
	return
}

// MarshalMsg implements msgp.Marshaler
func (z redirectionMsgs) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	o = msgp.AppendArrayHeader(o, uint32(len(z)))
	if uint32(len(z)) > zc920acdalimitArrays {
		return nil, msgp.ErrLimitExceeded
	}
	for zb0003 := range z {
		o, err = z[zb0003].MarshalMsg(o)
		if err != nil {
			err = msgp.WrapError(err, zb0003)
			return
		}
	}
	return
}

// UnmarshalMsg implements msgp.Unmarshaler
func (z *redirectionMsgs) UnmarshalMsg(bts []byte) (o []byte, err error) {
	var zb0002 uint32
	zb0002, bts, err = msgp.ReadArrayHeaderBytes(bts)
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	if zb0002 > zc920acdalimitArrays {
		err = msgp.ErrLimitExceeded
		return
	}
	if cap((*z)) >= int(zb0002) {
		(*z) = (*z)[:zb0002]
	} else {
		(*z) = make(redirectionMsgs, zb0002)
	}
	for zb0001 := range *z {
		bts, err = (*z)[zb0001].UnmarshalMsg(bts)
		if err != nil {
			err = msgp.WrapError(err, zb0001)
			return
		}
	}
	o = bts
	return
}

// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z redirectionMsgs) Msgsize() (s int) {
	s = msgp.ArrayHeaderSize
	for zb0003 := range z {
		s += z[zb0003].Msgsize()
	}
	return
}
