# automatically generated by the FlatBuffers compiler, do not modify

# namespace: flatbuf

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

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

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

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

    # Literal
    def ImplType(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
        return 0

    # Literal value data; for null literals do not include this field.
    # Literal
    def Impl(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            from flatbuffers.table import Table
            obj = Table(bytearray(), 0)
            self._tab.Union(obj, o)
            return obj
        return None

    # Type of the literal value. This must match `impl`.
    # Literal
    def Type(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from vast_flatbuf.org.apache.arrow.flatbuf.Field import Field
            obj = Field()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

def Start(builder): builder.StartObject(3)
def LiteralStart(builder):
    """This method is deprecated. Please switch to Start."""
    return Start(builder)
def AddImplType(builder, implType): builder.PrependUint8Slot(0, implType, 0)
def LiteralAddImplType(builder, implType):
    """This method is deprecated. Please switch to AddImplType."""
    return AddImplType(builder, implType)
def AddImpl(builder, impl): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(impl), 0)
def LiteralAddImpl(builder, impl):
    """This method is deprecated. Please switch to AddImpl."""
    return AddImpl(builder, impl)
def AddType(builder, type): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(type), 0)
def LiteralAddType(builder, type):
    """This method is deprecated. Please switch to AddType."""
    return AddType(builder, type)
def End(builder): return builder.EndObject()
def LiteralEnd(builder):
    """This method is deprecated. Please switch to End."""
    return End(builder)