from typing import Optional, override
from flut._flut.engine import FlutImmutableObject


class BorderRadius(FlutImmutableObject):
    def __init__(
        self,
        *,
        topLeft: float = 0.0,
        topRight: float = 0.0,
        bottomLeft: float = 0.0,
        bottomRight: float = 0.0,
    ):
        super().__init__("BorderRadius")
        self.topLeft = topLeft
        self.topRight = topRight
        self.bottomLeft = bottomLeft
        self.bottomRight = bottomRight

    @staticmethod
    def circular(radius):
        return BorderRadius(
            topLeft=radius, topRight=radius, bottomLeft=radius, bottomRight=radius
        )

    @staticmethod
    def all(radius):
        return BorderRadius.circular(radius)

    @override
    def _flut_pack(self) -> dict:
        result = self._flut_base_props()
        result["topLeft"] = self.topLeft
        result["topRight"] = self.topRight
        result["bottomLeft"] = self.bottomLeft
        result["bottomRight"] = self.bottomRight
        return result
