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

package scrabblefb

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

type MatchResult struct {
	_tab flatbuffers.Table
}

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

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

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

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

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

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

func (rcv *MatchResult) Matched() bool {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
	if o != 0 {
		return rcv._tab.GetBool(o + rcv._tab.Pos)
	}
	return false
}

func (rcv *MatchResult) MutateMatched(n bool) bool {
	return rcv._tab.MutateBoolSlot(4, n)
}

func (rcv *MatchResult) Game(obj *GameView) *GameView {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
	if o != 0 {
		x := rcv._tab.Indirect(o + rcv._tab.Pos)
		if obj == nil {
			obj = new(GameView)
		}
		obj.Init(rcv._tab.Bytes, x)
		return obj
	}
	return nil
}

func MatchResultStart(builder *flatbuffers.Builder) {
	builder.StartObject(2)
}
func MatchResultAddMatched(builder *flatbuffers.Builder, matched bool) {
	builder.PrependBoolSlot(0, matched, false)
}
func MatchResultAddGame(builder *flatbuffers.Builder, game flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(game), 0)
}
func MatchResultEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
	return builder.EndObject()
}
