# automatically generated by the FlatBuffers compiler, do not modify

# namespace: fb

from __future__ import annotations

from typing import Any, Optional

import flatbuffers
from flatbuffers.compat import import_numpy

from openmeteo_sdk.fb.TimeRange import TimeRange
from openmeteo_sdk.fb.ValuesAndUnit import ValuesAndUnit

np = import_numpy()


class MarineDaily:
    __slots__ = ["_tab"]

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

    @classmethod
    def GetRootAsMarineDaily(cls, buf, offset=0):
        """This method is deprecated. Please switch to GetRootAs."""
        return cls.GetRootAs(buf, offset)

    # MarineDaily
    def Init(self, buf: bytes, pos: int):
        self._tab = flatbuffers.table.Table(buf, pos)

    # MarineDaily
    def Time(self) -> TimeRange | None:
        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

    # MarineDaily
    def WaveHeightMax(self) -> ValuesAndUnit | None:
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            obj = ValuesAndUnit()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # MarineDaily
    def WindWaveHeightMax(self) -> ValuesAndUnit | None:
        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

    # MarineDaily
    def SwellWaveHeightMax(self) -> ValuesAndUnit | None:
        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

    # MarineDaily
    def WaveDirectionDominant(self) -> ValuesAndUnit | None:
        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

    # MarineDaily
    def WindWaveDirectionDominant(self) -> ValuesAndUnit | None:
        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

    # MarineDaily
    def SwellWaveDirectionDominant(self) -> ValuesAndUnit | None:
        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

    # MarineDaily
    def WavePeriodMax(self) -> ValuesAndUnit | None:
        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

    # MarineDaily
    def WindWavePeriodMax(self) -> ValuesAndUnit | None:
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            obj = ValuesAndUnit()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # MarineDaily
    def WindWavePeakPeriodMax(self) -> ValuesAndUnit | None:
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            obj = ValuesAndUnit()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # MarineDaily
    def SwellWavePeriodMax(self) -> ValuesAndUnit | None:
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            obj = ValuesAndUnit()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # MarineDaily
    def SwellWavePeakPeriodMax(self) -> ValuesAndUnit | None:
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            obj = ValuesAndUnit()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None


def MarineDailyStart(builder: flatbuffers.Builder):
    builder.StartObject(12)


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


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


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


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


def AddWaveHeightMax(builder: flatbuffers.Builder, waveHeightMax: int):
    MarineDailyAddWaveHeightMax(builder, waveHeightMax)


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


def AddWindWaveHeightMax(builder: flatbuffers.Builder, windWaveHeightMax: int):
    MarineDailyAddWindWaveHeightMax(builder, windWaveHeightMax)


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


def AddSwellWaveHeightMax(builder: flatbuffers.Builder, swellWaveHeightMax: int):
    MarineDailyAddSwellWaveHeightMax(builder, swellWaveHeightMax)


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


def AddWaveDirectionDominant(builder: flatbuffers.Builder, waveDirectionDominant: int):
    MarineDailyAddWaveDirectionDominant(builder, waveDirectionDominant)


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


def AddWindWaveDirectionDominant(builder: flatbuffers.Builder, windWaveDirectionDominant: int):
    MarineDailyAddWindWaveDirectionDominant(builder, windWaveDirectionDominant)


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


def AddSwellWaveDirectionDominant(builder: flatbuffers.Builder, swellWaveDirectionDominant: int):
    MarineDailyAddSwellWaveDirectionDominant(builder, swellWaveDirectionDominant)


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


def AddWavePeriodMax(builder: flatbuffers.Builder, wavePeriodMax: int):
    MarineDailyAddWavePeriodMax(builder, wavePeriodMax)


def MarineDailyAddWindWavePeriodMax(builder: flatbuffers.Builder, windWavePeriodMax: int):
    builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(windWavePeriodMax), 0)


def AddWindWavePeriodMax(builder: flatbuffers.Builder, windWavePeriodMax: int):
    MarineDailyAddWindWavePeriodMax(builder, windWavePeriodMax)


def MarineDailyAddWindWavePeakPeriodMax(builder: flatbuffers.Builder, windWavePeakPeriodMax: int):
    builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(windWavePeakPeriodMax), 0)


def AddWindWavePeakPeriodMax(builder: flatbuffers.Builder, windWavePeakPeriodMax: int):
    MarineDailyAddWindWavePeakPeriodMax(builder, windWavePeakPeriodMax)


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


def AddSwellWavePeriodMax(builder: flatbuffers.Builder, swellWavePeriodMax: int):
    MarineDailyAddSwellWavePeriodMax(builder, swellWavePeriodMax)


def MarineDailyAddSwellWavePeakPeriodMax(builder: flatbuffers.Builder, swellWavePeakPeriodMax: int):
    builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(swellWavePeakPeriodMax), 0)


def AddSwellWavePeakPeriodMax(builder: flatbuffers.Builder, swellWavePeakPeriodMax: int):
    MarineDailyAddSwellWavePeakPeriodMax(builder, swellWavePeakPeriodMax)


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


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