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

package order

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

type CommandItem struct {
	_tab flatbuffers.Table
}

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

func FinishCommandItemBuffer(builder *flatbuffers.Builder, offset flatbuffers.UOffsetT) {
	builder.Finish(offset)
}

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

func FinishSizePrefixedCommandItemBuffer(builder *flatbuffers.Builder, offset flatbuffers.UOffsetT) {
	builder.FinishSizePrefixed(offset)
}

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

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

func (rcv *CommandItem) CmdId() []byte {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
	if o != 0 {
		return rcv._tab.ByteVector(o + rcv._tab.Pos)
	}
	return nil
}

func (rcv *CommandItem) CmdApplied() *bool {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
	if o != 0 {
		v := rcv._tab.GetBool(o + rcv._tab.Pos)
		return &v
	}
	return nil
}

func (rcv *CommandItem) MutateCmdApplied(n bool) bool {
	return rcv._tab.MutateBoolSlot(6, n)
}

func (rcv *CommandItem) CmdErrorCode() *int64 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
	if o != 0 {
		v := rcv._tab.GetInt64(o + rcv._tab.Pos)
		return &v
	}
	return nil
}

func (rcv *CommandItem) MutateCmdErrorCode(n int64) bool {
	return rcv._tab.MutateInt64Slot(8, n)
}

func (rcv *CommandItem) PayloadType() CommandPayload {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
	if o != 0 {
		return CommandPayload(rcv._tab.GetByte(o + rcv._tab.Pos))
	}
	return 0
}

func (rcv *CommandItem) MutatePayloadType(n CommandPayload) bool {
	return rcv._tab.MutateByteSlot(10, byte(n))
}

func (rcv *CommandItem) Payload(obj *flatbuffers.Table) bool {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(12))
	if o != 0 {
		rcv._tab.Union(obj, o)
		return true
	}
	return false
}

func CommandItemStart(builder *flatbuffers.Builder) {
	builder.StartObject(5)
}
func CommandItemAddCmdId(builder *flatbuffers.Builder, cmdId flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(cmdId), 0)
}
func CommandItemAddCmdApplied(builder *flatbuffers.Builder, cmdApplied bool) {
	builder.PrependBool(cmdApplied)
	builder.Slot(1)
}
func CommandItemAddCmdErrorCode(builder *flatbuffers.Builder, cmdErrorCode int64) {
	builder.PrependInt64(cmdErrorCode)
	builder.Slot(2)
}
func CommandItemAddPayloadType(builder *flatbuffers.Builder, payloadType CommandPayload) {
	builder.PrependByteSlot(3, byte(payloadType), 0)
}
func CommandItemAddPayload(builder *flatbuffers.Builder, payload flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(4, flatbuffers.UOffsetT(payload), 0)
}
func CommandItemEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
	return builder.EndObject()
}
