# automatically generated by the FlatBuffers compiler, do not modify

# namespace: openmeteo_sdk

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

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

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

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

    # ValuesInt64AndUnit
    def Values(self, j: int):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8))
        return 0

    # ValuesInt64AndUnit
    def ValuesAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o)
        return 0

    # ValuesInt64AndUnit
    def ValuesLength(self) -> int:
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # ValuesInt64AndUnit
    def ValuesIsNone(self) -> bool:
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        return o == 0

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

def ValuesInt64AndUnitStart(builder: flatbuffers.Builder):
    builder.StartObject(2)

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

def ValuesInt64AndUnitAddValues(builder: flatbuffers.Builder, values: int):
    builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(values), 0)

def AddValues(builder: flatbuffers.Builder, values: int):
    ValuesInt64AndUnitAddValues(builder, values)

def ValuesInt64AndUnitStartValuesVector(builder, numElems: int) -> int:
    return builder.StartVector(8, numElems, 8)

def StartValuesVector(builder, numElems: int) -> int:
    return ValuesInt64AndUnitStartValuesVector(builder, numElems)

def ValuesInt64AndUnitAddUnit(builder: flatbuffers.Builder, unit: int):
    builder.PrependInt8Slot(1, unit, 0)

def AddUnit(builder: flatbuffers.Builder, unit: int):
    ValuesInt64AndUnitAddUnit(builder, unit)

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

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