# automatically generated by the FlatBuffers compiler, do not modify

# namespace: flatbuf

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

# Exact decimal value represented as an integer value in two's
# complement. Currently only 128-bit (16-byte) and 256-bit (32-byte) integers
# are used. The representation uses the endianness indicated
# in the Schema.
class Decimal(object):
    __slots__ = ['_tab']

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

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

    # Total number of decimal digits
    # Decimal
    def Precision(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return 0

    # Number of digits after the decimal point "."
    # Decimal
    def Scale(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return 0

    # Number of bits per value. The only accepted widths are 128 and 256.
    # We use bitWidth for consistency with Int::bitWidth.
    # Decimal
    def BitWidth(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return 128

def Start(builder): builder.StartObject(3)
def DecimalStart(builder):
    """This method is deprecated. Please switch to Start."""
    return Start(builder)
def AddPrecision(builder, precision): builder.PrependInt32Slot(0, precision, 0)
def DecimalAddPrecision(builder, precision):
    """This method is deprecated. Please switch to AddPrecision."""
    return AddPrecision(builder, precision)
def AddScale(builder, scale): builder.PrependInt32Slot(1, scale, 0)
def DecimalAddScale(builder, scale):
    """This method is deprecated. Please switch to AddScale."""
    return AddScale(builder, scale)
def AddBitWidth(builder, bitWidth): builder.PrependInt32Slot(2, bitWidth, 128)
def DecimalAddBitWidth(builder, bitWidth):
    """This method is deprecated. Please switch to AddBitWidth."""
    return AddBitWidth(builder, bitWidth)
def End(builder): return builder.EndObject()
def DecimalEnd(builder):
    """This method is deprecated. Please switch to End."""
    return End(builder)