# automatically generated by the FlatBuffers compiler, do not modify

# namespace: openmeteo_sdk

import flatbuffers
from flatbuffers.compat import import_numpy
from typing import Any
from openmeteo_sdk.TimeRange import TimeRange
from openmeteo_sdk.ValuesAndUnit import ValuesAndUnit
from openmeteo_sdk.ValuesUnitAndMember import ValuesUnitAndMember
from typing import Optional
np = import_numpy()

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

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

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

    # FloodDaily
    def Time(self) -> Optional[TimeRange]:
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            x = o + self._tab.Pos
            obj = TimeRange()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # FloodDaily
    def RiverDischarge(self) -> Optional[ValuesUnitAndMember]:
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            obj = ValuesUnitAndMember()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # FloodDaily
    def RiverDischargeMean(self) -> Optional[ValuesAndUnit]:
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            obj = ValuesAndUnit()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # FloodDaily
    def RiverDischargeMin(self) -> Optional[ValuesAndUnit]:
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            obj = ValuesAndUnit()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # FloodDaily
    def RiverDischargeMax(self) -> Optional[ValuesAndUnit]:
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            obj = ValuesAndUnit()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # FloodDaily
    def RiverDischargeMedian(self) -> Optional[ValuesAndUnit]:
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            obj = ValuesAndUnit()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # FloodDaily
    def RiverDischargeP25(self) -> Optional[ValuesAndUnit]:
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            obj = ValuesAndUnit()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # FloodDaily
    def RiverDischargeP75(self) -> Optional[ValuesAndUnit]:
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            obj = ValuesAndUnit()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

def FloodDailyStart(builder: flatbuffers.Builder):
    builder.StartObject(8)

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

def FloodDailyAddTime(builder: flatbuffers.Builder, time: Any):
    builder.PrependStructSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(time), 0)

def AddTime(builder: flatbuffers.Builder, time: Any):
    FloodDailyAddTime(builder, time)

def FloodDailyAddRiverDischarge(builder: flatbuffers.Builder, riverDischarge: int):
    builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(riverDischarge), 0)

def AddRiverDischarge(builder: flatbuffers.Builder, riverDischarge: int):
    FloodDailyAddRiverDischarge(builder, riverDischarge)

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

def AddRiverDischargeMean(builder: flatbuffers.Builder, riverDischargeMean: int):
    FloodDailyAddRiverDischargeMean(builder, riverDischargeMean)

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

def AddRiverDischargeMin(builder: flatbuffers.Builder, riverDischargeMin: int):
    FloodDailyAddRiverDischargeMin(builder, riverDischargeMin)

def FloodDailyAddRiverDischargeMax(builder: flatbuffers.Builder, riverDischargeMax: int):
    builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(riverDischargeMax), 0)

def AddRiverDischargeMax(builder: flatbuffers.Builder, riverDischargeMax: int):
    FloodDailyAddRiverDischargeMax(builder, riverDischargeMax)

def FloodDailyAddRiverDischargeMedian(builder: flatbuffers.Builder, riverDischargeMedian: int):
    builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(riverDischargeMedian), 0)

def AddRiverDischargeMedian(builder: flatbuffers.Builder, riverDischargeMedian: int):
    FloodDailyAddRiverDischargeMedian(builder, riverDischargeMedian)

def FloodDailyAddRiverDischargeP25(builder: flatbuffers.Builder, riverDischargeP25: int):
    builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(riverDischargeP25), 0)

def AddRiverDischargeP25(builder: flatbuffers.Builder, riverDischargeP25: int):
    FloodDailyAddRiverDischargeP25(builder, riverDischargeP25)

def FloodDailyAddRiverDischargeP75(builder: flatbuffers.Builder, riverDischargeP75: int):
    builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(riverDischargeP75), 0)

def AddRiverDischargeP75(builder: flatbuffers.Builder, riverDischargeP75: int):
    FloodDailyAddRiverDischargeP75(builder, riverDischargeP75)

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

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