"""SpiralBevelMeshedGearDesign"""

from __future__ import annotations

from typing import TYPE_CHECKING, ClassVar

from mastapy._private._internal.dataclasses import extended_dataclass
from mastapy._private._internal.exception_bridge import exception_bridge
from mastapy._private._internal.exceptions import CastException
from mastapy._private._internal.python_net import (
    python_net_import,
    pythonnet_property_get,
)
from mastapy._private._math.vector_2d import Vector2D

from mastapy._private._internal import conversion, utility
from mastapy._private.gears.gear_designs.bevel import _1329

_SPIRAL_BEVEL_MESHED_GEAR_DESIGN = python_net_import(
    "SMT.MastaAPI.Gears.GearDesigns.SpiralBevel", "SpiralBevelMeshedGearDesign"
)

if TYPE_CHECKING:
    from typing import Any, Type, TypeVar

    from mastapy._private.gears.gear_designs import _1074
    from mastapy._private.gears.gear_designs.agma_gleason_conical import _1342
    from mastapy._private.gears.gear_designs.conical import _1305

    Self = TypeVar("Self", bound="SpiralBevelMeshedGearDesign")
    CastSelf = TypeVar(
        "CastSelf",
        bound="SpiralBevelMeshedGearDesign._Cast_SpiralBevelMeshedGearDesign",
    )


__docformat__ = "restructuredtext en"
__all__ = ("SpiralBevelMeshedGearDesign",)


@extended_dataclass(frozen=True, slots=True, weakref_slot=True)
class _Cast_SpiralBevelMeshedGearDesign:
    """Special nested class for casting SpiralBevelMeshedGearDesign to subclasses."""

    __parent__: "SpiralBevelMeshedGearDesign"

    @property
    def bevel_meshed_gear_design(self: "CastSelf") -> "_1329.BevelMeshedGearDesign":
        return self.__parent__._cast(_1329.BevelMeshedGearDesign)

    @property
    def agma_gleason_conical_meshed_gear_design(
        self: "CastSelf",
    ) -> "_1342.AGMAGleasonConicalMeshedGearDesign":
        from mastapy._private.gears.gear_designs.agma_gleason_conical import _1342

        return self.__parent__._cast(_1342.AGMAGleasonConicalMeshedGearDesign)

    @property
    def conical_meshed_gear_design(self: "CastSelf") -> "_1305.ConicalMeshedGearDesign":
        from mastapy._private.gears.gear_designs.conical import _1305

        return self.__parent__._cast(_1305.ConicalMeshedGearDesign)

    @property
    def gear_design_component(self: "CastSelf") -> "_1074.GearDesignComponent":
        from mastapy._private.gears.gear_designs import _1074

        return self.__parent__._cast(_1074.GearDesignComponent)

    @property
    def spiral_bevel_meshed_gear_design(
        self: "CastSelf",
    ) -> "SpiralBevelMeshedGearDesign":
        return self.__parent__

    def __getattr__(self: "CastSelf", name: str) -> "Any":
        try:
            return self.__getattribute__(name)
        except AttributeError:
            class_name = utility.camel(name)
            raise CastException(
                f'Detected an invalid cast. Cannot cast to type "{class_name}"'
            ) from None


@extended_dataclass(frozen=True, slots=True, weakref_slot=True, eq=False)
class SpiralBevelMeshedGearDesign(_1329.BevelMeshedGearDesign):
    """SpiralBevelMeshedGearDesign

    This is a mastapy class.
    """

    TYPE: ClassVar["Type"] = _SPIRAL_BEVEL_MESHED_GEAR_DESIGN

    wrapped: "Any"

    def __post_init__(self: "Self") -> None:
        """Override of the post initialisation magic method."""
        if not hasattr(self.wrapped, "reference_count"):
            self.wrapped.reference_count = 0

        self.wrapped.reference_count += 1

    @property
    @exception_bridge
    def tip_point_at_mean_section(self: "Self") -> "Vector2D":
        """Vector2D

        Note:
            This property is readonly.
        """
        temp = pythonnet_property_get(self.wrapped, "TipPointAtMeanSection")

        if temp is None:
            return None

        value = conversion.pn_to_mp_vector2d(temp)

        if value is None:
            return None

        return value

    @property
    @exception_bridge
    def tip_thickness_at_mean_section(self: "Self") -> "float":
        """float

        Note:
            This property is readonly.
        """
        temp = pythonnet_property_get(self.wrapped, "TipThicknessAtMeanSection")

        if temp is None:
            return 0.0

        return temp

    @property
    def cast_to(self: "Self") -> "_Cast_SpiralBevelMeshedGearDesign":
        """Cast to another type.

        Returns:
            _Cast_SpiralBevelMeshedGearDesign
        """
        return _Cast_SpiralBevelMeshedGearDesign(self)
