# automatically generated by the FlatBuffers compiler, do not modify

# namespace: Packets

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

class QueryObjectInteractableResult(object):
    __slots__ = ['_tab']

    @classmethod
    def GetRootAs(cls, buf, offset=0):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
        x = QueryObjectInteractableResult()
        x.Init(buf, n + offset)
        return x

    @classmethod
    def GetRootAsQueryObjectInteractableResult(cls, buf, offset=0):
        """This method is deprecated. Please switch to GetRootAs."""
        return cls.GetRootAs(buf, offset)
    # QueryObjectInteractableResult
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # QueryObjectInteractableResult
    def IsInteractable(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
        return False

def QueryObjectInteractableResultStart(builder): builder.StartObject(1)
def Start(builder):
    return QueryObjectInteractableResultStart(builder)
def QueryObjectInteractableResultAddIsInteractable(builder, isInteractable): builder.PrependBoolSlot(0, isInteractable, 0)
def AddIsInteractable(builder, isInteractable):
    return QueryObjectInteractableResultAddIsInteractable(builder, isInteractable)
def QueryObjectInteractableResultEnd(builder): return builder.EndObject()
def End(builder):
    return QueryObjectInteractableResultEnd(builder)

class QueryObjectInteractableResultT(object):

    # QueryObjectInteractableResultT
    def __init__(self):
        self.isInteractable = False  # type: bool

    @classmethod
    def InitFromBuf(cls, buf, pos):
        queryObjectInteractableResult = QueryObjectInteractableResult()
        queryObjectInteractableResult.Init(buf, pos)
        return cls.InitFromObj(queryObjectInteractableResult)

    @classmethod
    def InitFromPackedBuf(cls, buf, pos=0):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
        return cls.InitFromBuf(buf, pos+n)

    @classmethod
    def InitFromObj(cls, queryObjectInteractableResult):
        x = QueryObjectInteractableResultT()
        x._UnPack(queryObjectInteractableResult)
        return x

    # QueryObjectInteractableResultT
    def _UnPack(self, queryObjectInteractableResult):
        if queryObjectInteractableResult is None:
            return
        self.isInteractable = queryObjectInteractableResult.IsInteractable()

    # QueryObjectInteractableResultT
    def Pack(self, builder):
        QueryObjectInteractableResultStart(builder)
        QueryObjectInteractableResultAddIsInteractable(builder, self.isInteractable)
        queryObjectInteractableResult = QueryObjectInteractableResultEnd(builder)
        return queryObjectInteractableResult
