package cmd

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

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

// DecodeMsg implements msgp.Decodable
func (z *ServerSystemConfig) 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 "NEndpoints":
			z.NEndpoints, err = dc.ReadInt()
			if err != nil {
				err = msgp.WrapError(err, "NEndpoints")
				return
			}
		case "CmdLines":
			var zb0002 uint32
			zb0002, err = dc.ReadArrayHeader()
			if err != nil {
				err = msgp.WrapError(err, "CmdLines")
				return
			}
			if cap(z.CmdLines) >= int(zb0002) {
				z.CmdLines = (z.CmdLines)[:zb0002]
			} else {
				z.CmdLines = make([]string, zb0002)
			}
			for za0001 := range z.CmdLines {
				z.CmdLines[za0001], err = dc.ReadString()
				if err != nil {
					err = msgp.WrapError(err, "CmdLines", za0001)
					return
				}
			}
		case "MinioEnv":
			var zb0003 uint32
			zb0003, err = dc.ReadMapHeader()
			if err != nil {
				err = msgp.WrapError(err, "MinioEnv")
				return
			}
			if z.MinioEnv == nil {
				z.MinioEnv = make(map[string]string, zb0003)
			} else if len(z.MinioEnv) > 0 {
				for key := range z.MinioEnv {
					delete(z.MinioEnv, key)
				}
			}
			for zb0003 > 0 {
				zb0003--
				var za0002 string
				var za0003 string
				za0002, err = dc.ReadString()
				if err != nil {
					err = msgp.WrapError(err, "MinioEnv")
					return
				}
				za0003, err = dc.ReadString()
				if err != nil {
					err = msgp.WrapError(err, "MinioEnv", za0002)
					return
				}
				z.MinioEnv[za0002] = za0003
			}
		case "Checksum":
			z.Checksum, err = dc.ReadString()
			if err != nil {
				err = msgp.WrapError(err, "Checksum")
				return
			}
		default:
			err = dc.Skip()
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	return
}

// EncodeMsg implements msgp.Encodable
func (z *ServerSystemConfig) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 4
	// write "NEndpoints"
	err = en.Append(0x84, 0xaa, 0x4e, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73)
	if err != nil {
		return
	}
	err = en.WriteInt(z.NEndpoints)
	if err != nil {
		err = msgp.WrapError(err, "NEndpoints")
		return
	}
	// write "CmdLines"
	err = en.Append(0xa8, 0x43, 0x6d, 0x64, 0x4c, 0x69, 0x6e, 0x65, 0x73)
	if err != nil {
		return
	}
	err = en.WriteArrayHeader(uint32(len(z.CmdLines)))
	if err != nil {
		err = msgp.WrapError(err, "CmdLines")
		return
	}
	for za0001 := range z.CmdLines {
		err = en.WriteString(z.CmdLines[za0001])
		if err != nil {
			err = msgp.WrapError(err, "CmdLines", za0001)
			return
		}
	}
	// write "MinioEnv"
	err = en.Append(0xa8, 0x4d, 0x69, 0x6e, 0x69, 0x6f, 0x45, 0x6e, 0x76)
	if err != nil {
		return
	}
	err = en.WriteMapHeader(uint32(len(z.MinioEnv)))
	if err != nil {
		err = msgp.WrapError(err, "MinioEnv")
		return
	}
	for za0002, za0003 := range z.MinioEnv {
		err = en.WriteString(za0002)
		if err != nil {
			err = msgp.WrapError(err, "MinioEnv")
			return
		}
		err = en.WriteString(za0003)
		if err != nil {
			err = msgp.WrapError(err, "MinioEnv", za0002)
			return
		}
	}
	// write "Checksum"
	err = en.Append(0xa8, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d)
	if err != nil {
		return
	}
	err = en.WriteString(z.Checksum)
	if err != nil {
		err = msgp.WrapError(err, "Checksum")
		return
	}
	return
}

// MarshalMsg implements msgp.Marshaler
func (z *ServerSystemConfig) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 4
	// string "NEndpoints"
	o = append(o, 0x84, 0xaa, 0x4e, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73)
	o = msgp.AppendInt(o, z.NEndpoints)
	// string "CmdLines"
	o = append(o, 0xa8, 0x43, 0x6d, 0x64, 0x4c, 0x69, 0x6e, 0x65, 0x73)
	o = msgp.AppendArrayHeader(o, uint32(len(z.CmdLines)))
	for za0001 := range z.CmdLines {
		o = msgp.AppendString(o, z.CmdLines[za0001])
	}
	// string "MinioEnv"
	o = append(o, 0xa8, 0x4d, 0x69, 0x6e, 0x69, 0x6f, 0x45, 0x6e, 0x76)
	o = msgp.AppendMapHeader(o, uint32(len(z.MinioEnv)))
	for za0002, za0003 := range z.MinioEnv {
		o = msgp.AppendString(o, za0002)
		o = msgp.AppendString(o, za0003)
	}
	// string "Checksum"
	o = append(o, 0xa8, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d)
	o = msgp.AppendString(o, z.Checksum)
	return
}

// UnmarshalMsg implements msgp.Unmarshaler
func (z *ServerSystemConfig) 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 "NEndpoints":
			z.NEndpoints, bts, err = msgp.ReadIntBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "NEndpoints")
				return
			}
		case "CmdLines":
			var zb0002 uint32
			zb0002, bts, err = msgp.ReadArrayHeaderBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "CmdLines")
				return
			}
			if cap(z.CmdLines) >= int(zb0002) {
				z.CmdLines = (z.CmdLines)[:zb0002]
			} else {
				z.CmdLines = make([]string, zb0002)
			}
			for za0001 := range z.CmdLines {
				z.CmdLines[za0001], bts, err = msgp.ReadStringBytes(bts)
				if err != nil {
					err = msgp.WrapError(err, "CmdLines", za0001)
					return
				}
			}
		case "MinioEnv":
			var zb0003 uint32
			zb0003, bts, err = msgp.ReadMapHeaderBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "MinioEnv")
				return
			}
			if z.MinioEnv == nil {
				z.MinioEnv = make(map[string]string, zb0003)
			} else if len(z.MinioEnv) > 0 {
				for key := range z.MinioEnv {
					delete(z.MinioEnv, key)
				}
			}
			for zb0003 > 0 {
				var za0002 string
				var za0003 string
				zb0003--
				za0002, bts, err = msgp.ReadStringBytes(bts)
				if err != nil {
					err = msgp.WrapError(err, "MinioEnv")
					return
				}
				za0003, bts, err = msgp.ReadStringBytes(bts)
				if err != nil {
					err = msgp.WrapError(err, "MinioEnv", za0002)
					return
				}
				z.MinioEnv[za0002] = za0003
			}
		case "Checksum":
			z.Checksum, bts, err = msgp.ReadStringBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "Checksum")
				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 *ServerSystemConfig) Msgsize() (s int) {
	s = 1 + 11 + msgp.IntSize + 9 + msgp.ArrayHeaderSize
	for za0001 := range z.CmdLines {
		s += msgp.StringPrefixSize + len(z.CmdLines[za0001])
	}
	s += 9 + msgp.MapHeaderSize
	if z.MinioEnv != nil {
		for za0002, za0003 := range z.MinioEnv {
			_ = za0003
			s += msgp.StringPrefixSize + len(za0002) + msgp.StringPrefixSize + len(za0003)
		}
	}
	s += 9 + msgp.StringPrefixSize + len(z.Checksum)
	return
}
