// Code generated by the FlatBuffers compiler. DO NOT EDIT.

package message_fbs

import (
	flatbuffers "github.com/google/flatbuffers/go"
)

type MessageBatch struct {
	_tab flatbuffers.Table
}

func GetRootAsMessageBatch(buf []byte, offset flatbuffers.UOffsetT) *MessageBatch {
	n := flatbuffers.GetUOffsetT(buf[offset:])
	x := &MessageBatch{}
	x.Init(buf, n+offset)
	return x
}

func GetSizePrefixedRootAsMessageBatch(buf []byte, offset flatbuffers.UOffsetT) *MessageBatch {
	n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:])
	x := &MessageBatch{}
	x.Init(buf, n+offset+flatbuffers.SizeUint32)
	return x
}

func (rcv *MessageBatch) Init(buf []byte, i flatbuffers.UOffsetT) {
	rcv._tab.Bytes = buf
	rcv._tab.Pos = i
}

func (rcv *MessageBatch) Table() flatbuffers.Table {
	return rcv._tab
}

func (rcv *MessageBatch) ProducerId() int32 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
	if o != 0 {
		return rcv._tab.GetInt32(o + rcv._tab.Pos)
	}
	return 0
}

func (rcv *MessageBatch) MutateProducerId(n int32) bool {
	return rcv._tab.MutateInt32Slot(4, n)
}

func (rcv *MessageBatch) ProducerEpoch() int32 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
	if o != 0 {
		return rcv._tab.GetInt32(o + rcv._tab.Pos)
	}
	return 0
}

func (rcv *MessageBatch) MutateProducerEpoch(n int32) bool {
	return rcv._tab.MutateInt32Slot(6, n)
}

func (rcv *MessageBatch) SegmentId() int32 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
	if o != 0 {
		return rcv._tab.GetInt32(o + rcv._tab.Pos)
	}
	return 0
}

func (rcv *MessageBatch) MutateSegmentId(n int32) bool {
	return rcv._tab.MutateInt32Slot(8, n)
}

func (rcv *MessageBatch) Flags() int32 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
	if o != 0 {
		return rcv._tab.GetInt32(o + rcv._tab.Pos)
	}
	return 0
}

func (rcv *MessageBatch) MutateFlags(n int32) bool {
	return rcv._tab.MutateInt32Slot(10, n)
}

func (rcv *MessageBatch) SegmentSeqBase() int64 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(12))
	if o != 0 {
		return rcv._tab.GetInt64(o + rcv._tab.Pos)
	}
	return 0
}

func (rcv *MessageBatch) MutateSegmentSeqBase(n int64) bool {
	return rcv._tab.MutateInt64Slot(12, n)
}

func (rcv *MessageBatch) SegmentSeqMaxDelta() int32 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(14))
	if o != 0 {
		return rcv._tab.GetInt32(o + rcv._tab.Pos)
	}
	return 0
}

func (rcv *MessageBatch) MutateSegmentSeqMaxDelta(n int32) bool {
	return rcv._tab.MutateInt32Slot(14, n)
}

func (rcv *MessageBatch) TsMsBase() int64 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(16))
	if o != 0 {
		return rcv._tab.GetInt64(o + rcv._tab.Pos)
	}
	return 0
}

func (rcv *MessageBatch) MutateTsMsBase(n int64) bool {
	return rcv._tab.MutateInt64Slot(16, n)
}

func (rcv *MessageBatch) TsMsMaxDelta() int32 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(18))
	if o != 0 {
		return rcv._tab.GetInt32(o + rcv._tab.Pos)
	}
	return 0
}

func (rcv *MessageBatch) MutateTsMsMaxDelta(n int32) bool {
	return rcv._tab.MutateInt32Slot(18, n)
}

func (rcv *MessageBatch) Messages(obj *Message, j int) bool {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(20))
	if o != 0 {
		x := rcv._tab.Vector(o)
		x += flatbuffers.UOffsetT(j) * 4
		x = rcv._tab.Indirect(x)
		obj.Init(rcv._tab.Bytes, x)
		return true
	}
	return false
}

func (rcv *MessageBatch) MessagesLength() int {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(20))
	if o != 0 {
		return rcv._tab.VectorLen(o)
	}
	return 0
}

func MessageBatchStart(builder *flatbuffers.Builder) {
	builder.StartObject(9)
}
func MessageBatchAddProducerId(builder *flatbuffers.Builder, producerId int32) {
	builder.PrependInt32Slot(0, producerId, 0)
}
func MessageBatchAddProducerEpoch(builder *flatbuffers.Builder, producerEpoch int32) {
	builder.PrependInt32Slot(1, producerEpoch, 0)
}
func MessageBatchAddSegmentId(builder *flatbuffers.Builder, segmentId int32) {
	builder.PrependInt32Slot(2, segmentId, 0)
}
func MessageBatchAddFlags(builder *flatbuffers.Builder, flags int32) {
	builder.PrependInt32Slot(3, flags, 0)
}
func MessageBatchAddSegmentSeqBase(builder *flatbuffers.Builder, segmentSeqBase int64) {
	builder.PrependInt64Slot(4, segmentSeqBase, 0)
}
func MessageBatchAddSegmentSeqMaxDelta(builder *flatbuffers.Builder, segmentSeqMaxDelta int32) {
	builder.PrependInt32Slot(5, segmentSeqMaxDelta, 0)
}
func MessageBatchAddTsMsBase(builder *flatbuffers.Builder, tsMsBase int64) {
	builder.PrependInt64Slot(6, tsMsBase, 0)
}
func MessageBatchAddTsMsMaxDelta(builder *flatbuffers.Builder, tsMsMaxDelta int32) {
	builder.PrependInt32Slot(7, tsMsMaxDelta, 0)
}
func MessageBatchAddMessages(builder *flatbuffers.Builder, messages flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(8, flatbuffers.UOffsetT(messages), 0)
}
func MessageBatchStartMessagesVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
	return builder.StartVector(4, numElems, 4)
}
func MessageBatchEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
	return builder.EndObject()
}
