package storagesc

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

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

// MarshalMsg implements msgp.Marshaler
func (z *BlobberRewardNode) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 6
	// string "ID"
	o = append(o, 0x86, 0xa2, 0x49, 0x44)
	o = msgp.AppendString(o, z.ID)
	// string "SuccessChallenges"
	o = append(o, 0xb1, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x73)
	o = msgp.AppendInt(o, z.SuccessChallenges)
	// string "WritePrice"
	o = append(o, 0xaa, 0x57, 0x72, 0x69, 0x74, 0x65, 0x50, 0x72, 0x69, 0x63, 0x65)
	o, err = z.WritePrice.MarshalMsg(o)
	if err != nil {
		err = msgp.WrapError(err, "WritePrice")
		return
	}
	// string "ReadPrice"
	o = append(o, 0xa9, 0x52, 0x65, 0x61, 0x64, 0x50, 0x72, 0x69, 0x63, 0x65)
	o, err = z.ReadPrice.MarshalMsg(o)
	if err != nil {
		err = msgp.WrapError(err, "ReadPrice")
		return
	}
	// string "TotalData"
	o = append(o, 0xa9, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61)
	o = msgp.AppendFloat64(o, z.TotalData)
	// string "DataRead"
	o = append(o, 0xa8, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x61, 0x64)
	o = msgp.AppendFloat64(o, z.DataRead)
	return
}

// UnmarshalMsg implements msgp.Unmarshaler
func (z *BlobberRewardNode) 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 "SuccessChallenges":
			z.SuccessChallenges, bts, err = msgp.ReadIntBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "SuccessChallenges")
				return
			}
		case "WritePrice":
			bts, err = z.WritePrice.UnmarshalMsg(bts)
			if err != nil {
				err = msgp.WrapError(err, "WritePrice")
				return
			}
		case "ReadPrice":
			bts, err = z.ReadPrice.UnmarshalMsg(bts)
			if err != nil {
				err = msgp.WrapError(err, "ReadPrice")
				return
			}
		case "TotalData":
			z.TotalData, bts, err = msgp.ReadFloat64Bytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "TotalData")
				return
			}
		case "DataRead":
			z.DataRead, bts, err = msgp.ReadFloat64Bytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "DataRead")
				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 *BlobberRewardNode) Msgsize() (s int) {
	s = 1 + 3 + msgp.StringPrefixSize + len(z.ID) + 18 + msgp.IntSize + 11 + z.WritePrice.Msgsize() + 10 + z.ReadPrice.Msgsize() + 10 + msgp.Float64Size + 9 + msgp.Float64Size
	return
}
