from typing import override

from flut._flut.engine import FlutImmutableObject
from flut._flut.runtime import _flut_unpack_optional_field


class TextTheme(FlutImmutableObject):
    def __init__(self, *, headlineMedium=None):
        super().__init__("TextTheme")
        self.headlineMedium = headlineMedium

    @override
    def _flut_pack(self) -> dict:
        result = self._flut_base_props()
        if self.headlineMedium is not None:
            result["headlineMedium"] = self.headlineMedium._flut_pack()
        return result

    @staticmethod
    def _flut_unpack(data: dict) -> "TextTheme":
        return TextTheme(
            headlineMedium=_flut_unpack_optional_field(data, "headlineMedium")
        )
