from typing import Optional, override

from flut.flutter.widgets.framework import Widget


class Tooltip(Widget):
    def __init__(
        self,
        *,
        key=None,
        message: Optional[str] = None,
        verticalOffset: Optional[float] = None,
        preferBelow: Optional[bool] = None,
        textStyle=None,
        waitDuration=None,
        showDuration=None,
        child: Optional[Widget] = None,
    ):
        super().__init__("Tooltip", key=key)
        self.message = message
        self.verticalOffset = verticalOffset
        self.preferBelow = preferBelow
        self.textStyle = textStyle
        self.waitDuration = waitDuration
        self.showDuration = showDuration
        self.child = child

    @override
    def _flut_pack(self) -> dict:
        result = self._flut_base_props()
        if self.message is not None:
            result["message"] = self.message
        if self.verticalOffset is not None:
            result["verticalOffset"] = self.verticalOffset
        if self.preferBelow is not None:
            result["preferBelow"] = self.preferBelow
        if self.textStyle is not None:
            result["textStyle"] = self.textStyle._flut_pack()
        if self.waitDuration is not None:
            result["waitDuration"] = self.waitDuration._flut_pack()
        if self.showDuration is not None:
            result["showDuration"] = self.showDuration._flut_pack()
        if self.child is not None:
            result["child"] = self.child._flut_pack()
        return result
