# automatically generated by the FlatBuffers compiler, do not modify

# namespace: FlatGeobuf

import flatbuffers
from flatbuffers.compat import import_numpy
from typing import Any
from typing import Optional
np = import_numpy()

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

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

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

    # Column
    def Name(self) -> Optional[str]:
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

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

    # Column
    def Title(self) -> Optional[str]:
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # Column
    def Description(self) -> Optional[str]:
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # Column
    def Width(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return -1

    # Column
    def Precision(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return -1

    # Column
    def Scale(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return -1

    # Column
    def Nullable(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
        return True

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

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

    # Column
    def Metadata(self) -> Optional[str]:
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

def ColumnStart(builder: flatbuffers.Builder):
    builder.StartObject(11)

def Start(builder: flatbuffers.Builder):
    ColumnStart(builder)

def ColumnAddName(builder: flatbuffers.Builder, name: int):
    builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)

def AddName(builder: flatbuffers.Builder, name: int):
    ColumnAddName(builder, name)

def ColumnAddType(builder: flatbuffers.Builder, type: int):
    builder.PrependUint8Slot(1, type, 0)

def AddType(builder: flatbuffers.Builder, type: int):
    ColumnAddType(builder, type)

def ColumnAddTitle(builder: flatbuffers.Builder, title: int):
    builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(title), 0)

def AddTitle(builder: flatbuffers.Builder, title: int):
    ColumnAddTitle(builder, title)

def ColumnAddDescription(builder: flatbuffers.Builder, description: int):
    builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(description), 0)

def AddDescription(builder: flatbuffers.Builder, description: int):
    ColumnAddDescription(builder, description)

def ColumnAddWidth(builder: flatbuffers.Builder, width: int):
    builder.PrependInt32Slot(4, width, -1)

def AddWidth(builder: flatbuffers.Builder, width: int):
    ColumnAddWidth(builder, width)

def ColumnAddPrecision(builder: flatbuffers.Builder, precision: int):
    builder.PrependInt32Slot(5, precision, -1)

def AddPrecision(builder: flatbuffers.Builder, precision: int):
    ColumnAddPrecision(builder, precision)

def ColumnAddScale(builder: flatbuffers.Builder, scale: int):
    builder.PrependInt32Slot(6, scale, -1)

def AddScale(builder: flatbuffers.Builder, scale: int):
    ColumnAddScale(builder, scale)

def ColumnAddNullable(builder: flatbuffers.Builder, nullable: bool):
    builder.PrependBoolSlot(7, nullable, 1)

def AddNullable(builder: flatbuffers.Builder, nullable: bool):
    ColumnAddNullable(builder, nullable)

def ColumnAddUnique(builder: flatbuffers.Builder, unique: bool):
    builder.PrependBoolSlot(8, unique, 0)

def AddUnique(builder: flatbuffers.Builder, unique: bool):
    ColumnAddUnique(builder, unique)

def ColumnAddPrimaryKey(builder: flatbuffers.Builder, primaryKey: bool):
    builder.PrependBoolSlot(9, primaryKey, 0)

def AddPrimaryKey(builder: flatbuffers.Builder, primaryKey: bool):
    ColumnAddPrimaryKey(builder, primaryKey)

def ColumnAddMetadata(builder: flatbuffers.Builder, metadata: int):
    builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(metadata), 0)

def AddMetadata(builder: flatbuffers.Builder, metadata: int):
    ColumnAddMetadata(builder, metadata)

def ColumnEnd(builder: flatbuffers.Builder) -> int:
    return builder.EndObject()

def End(builder: flatbuffers.Builder) -> int:
    return ColumnEnd(builder)
