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

package lextwt

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

type Link struct {
	_tab flatbuffers.Table
}

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

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

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

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

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

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

func (rcv *Link) Type() LinkType {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
	if o != 0 {
		return LinkType(rcv._tab.GetInt8(o + rcv._tab.Pos))
	}
	return 1
}

func (rcv *Link) MutateType(n LinkType) bool {
	return rcv._tab.MutateInt8Slot(4, int8(n))
}

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

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

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

func LinkStart(builder *flatbuffers.Builder) {
	builder.StartObject(4)
}
func LinkAddType(builder *flatbuffers.Builder, type_ LinkType) {
	builder.PrependInt8Slot(0, int8(type_), 1)
}
func LinkAddAlt(builder *flatbuffers.Builder, alt flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(alt), 0)
}
func LinkAddTarget(builder *flatbuffers.Builder, target flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(2, flatbuffers.UOffsetT(target), 0)
}
func LinkAddTitle(builder *flatbuffers.Builder, title flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(3, flatbuffers.UOffsetT(title), 0)
}
func LinkEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
	return builder.EndObject()
}
