package madmin

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

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

// DecodeMsg implements msgp.Decodable
func (z *LicenseInfo) 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 "ID":
			z.ID, err = dc.ReadString()
			if err != nil {
				err = msgp.WrapError(err, "ID")
				return
			}
		case "Organization":
			z.Organization, err = dc.ReadString()
			if err != nil {
				err = msgp.WrapError(err, "Organization")
				return
			}
		case "Plan":
			z.Plan, err = dc.ReadString()
			if err != nil {
				err = msgp.WrapError(err, "Plan")
				return
			}
		case "IssuedAt":
			z.IssuedAt, err = dc.ReadTime()
			if err != nil {
				err = msgp.WrapError(err, "IssuedAt")
				return
			}
		case "ExpiresAt":
			z.ExpiresAt, err = dc.ReadTime()
			if err != nil {
				err = msgp.WrapError(err, "ExpiresAt")
				return
			}
		case "Trial":
			z.Trial, err = dc.ReadBool()
			if err != nil {
				err = msgp.WrapError(err, "Trial")
				return
			}
		case "APIKey":
			z.APIKey, err = dc.ReadString()
			if err != nil {
				err = msgp.WrapError(err, "APIKey")
				return
			}
		default:
			err = dc.Skip()
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	return
}

// EncodeMsg implements msgp.Encodable
func (z *LicenseInfo) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 7
	// write "ID"
	err = en.Append(0x87, 0xa2, 0x49, 0x44)
	if err != nil {
		return
	}
	err = en.WriteString(z.ID)
	if err != nil {
		err = msgp.WrapError(err, "ID")
		return
	}
	// write "Organization"
	err = en.Append(0xac, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e)
	if err != nil {
		return
	}
	err = en.WriteString(z.Organization)
	if err != nil {
		err = msgp.WrapError(err, "Organization")
		return
	}
	// write "Plan"
	err = en.Append(0xa4, 0x50, 0x6c, 0x61, 0x6e)
	if err != nil {
		return
	}
	err = en.WriteString(z.Plan)
	if err != nil {
		err = msgp.WrapError(err, "Plan")
		return
	}
	// write "IssuedAt"
	err = en.Append(0xa8, 0x49, 0x73, 0x73, 0x75, 0x65, 0x64, 0x41, 0x74)
	if err != nil {
		return
	}
	err = en.WriteTime(z.IssuedAt)
	if err != nil {
		err = msgp.WrapError(err, "IssuedAt")
		return
	}
	// write "ExpiresAt"
	err = en.Append(0xa9, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x41, 0x74)
	if err != nil {
		return
	}
	err = en.WriteTime(z.ExpiresAt)
	if err != nil {
		err = msgp.WrapError(err, "ExpiresAt")
		return
	}
	// write "Trial"
	err = en.Append(0xa5, 0x54, 0x72, 0x69, 0x61, 0x6c)
	if err != nil {
		return
	}
	err = en.WriteBool(z.Trial)
	if err != nil {
		err = msgp.WrapError(err, "Trial")
		return
	}
	// write "APIKey"
	err = en.Append(0xa6, 0x41, 0x50, 0x49, 0x4b, 0x65, 0x79)
	if err != nil {
		return
	}
	err = en.WriteString(z.APIKey)
	if err != nil {
		err = msgp.WrapError(err, "APIKey")
		return
	}
	return
}

// MarshalMsg implements msgp.Marshaler
func (z *LicenseInfo) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 7
	// string "ID"
	o = append(o, 0x87, 0xa2, 0x49, 0x44)
	o = msgp.AppendString(o, z.ID)
	// string "Organization"
	o = append(o, 0xac, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e)
	o = msgp.AppendString(o, z.Organization)
	// string "Plan"
	o = append(o, 0xa4, 0x50, 0x6c, 0x61, 0x6e)
	o = msgp.AppendString(o, z.Plan)
	// string "IssuedAt"
	o = append(o, 0xa8, 0x49, 0x73, 0x73, 0x75, 0x65, 0x64, 0x41, 0x74)
	o = msgp.AppendTime(o, z.IssuedAt)
	// string "ExpiresAt"
	o = append(o, 0xa9, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x41, 0x74)
	o = msgp.AppendTime(o, z.ExpiresAt)
	// string "Trial"
	o = append(o, 0xa5, 0x54, 0x72, 0x69, 0x61, 0x6c)
	o = msgp.AppendBool(o, z.Trial)
	// string "APIKey"
	o = append(o, 0xa6, 0x41, 0x50, 0x49, 0x4b, 0x65, 0x79)
	o = msgp.AppendString(o, z.APIKey)
	return
}

// UnmarshalMsg implements msgp.Unmarshaler
func (z *LicenseInfo) 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 "ID":
			z.ID, bts, err = msgp.ReadStringBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "ID")
				return
			}
		case "Organization":
			z.Organization, bts, err = msgp.ReadStringBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "Organization")
				return
			}
		case "Plan":
			z.Plan, bts, err = msgp.ReadStringBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "Plan")
				return
			}
		case "IssuedAt":
			z.IssuedAt, bts, err = msgp.ReadTimeBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "IssuedAt")
				return
			}
		case "ExpiresAt":
			z.ExpiresAt, bts, err = msgp.ReadTimeBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "ExpiresAt")
				return
			}
		case "Trial":
			z.Trial, bts, err = msgp.ReadBoolBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "Trial")
				return
			}
		case "APIKey":
			z.APIKey, bts, err = msgp.ReadStringBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "APIKey")
				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 *LicenseInfo) Msgsize() (s int) {
	s = 1 + 3 + msgp.StringPrefixSize + len(z.ID) + 13 + msgp.StringPrefixSize + len(z.Organization) + 5 + msgp.StringPrefixSize + len(z.Plan) + 9 + msgp.TimeSize + 10 + msgp.TimeSize + 6 + msgp.BoolSize + 7 + msgp.StringPrefixSize + len(z.APIKey)
	return
}
