"""MountableComponent"""

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_method_call,
    pythonnet_property_get,
    pythonnet_property_set,
)
from mastapy._private._internal.type_enforcement import enforce_parameter_types

from mastapy._private._internal import constructor, utility
from mastapy._private.system_model.part_model import _2716

_MOUNTABLE_COMPONENT = python_net_import(
    "SMT.MastaAPI.SystemModel.PartModel", "MountableComponent"
)

if TYPE_CHECKING:
    from typing import Any, Type, TypeVar

    from mastapy._private.system_model import _2453
    from mastapy._private.system_model.connections_and_sockets import (
        _2530,
        _2533,
        _2537,
    )
    from mastapy._private.system_model.part_model import (
        _2706,
        _2710,
        _2717,
        _2719,
        _2735,
        _2736,
        _2741,
        _2744,
        _2746,
        _2748,
        _2749,
        _2755,
        _2757,
    )
    from mastapy._private.system_model.part_model.couplings import (
        _2864,
        _2867,
        _2870,
        _2873,
        _2875,
        _2877,
        _2884,
        _2886,
        _2893,
        _2896,
        _2897,
        _2898,
        _2900,
        _2902,
    )
    from mastapy._private.system_model.part_model.cycloidal import _2854
    from mastapy._private.system_model.part_model.gears import (
        _2796,
        _2798,
        _2800,
        _2801,
        _2802,
        _2804,
        _2806,
        _2808,
        _2810,
        _2811,
        _2813,
        _2817,
        _2819,
        _2821,
        _2823,
        _2827,
        _2829,
        _2831,
        _2833,
        _2834,
        _2835,
        _2837,
    )

    Self = TypeVar("Self", bound="MountableComponent")
    CastSelf = TypeVar("CastSelf", bound="MountableComponent._Cast_MountableComponent")


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


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

    __parent__: "MountableComponent"

    @property
    def component(self: "CastSelf") -> "_2716.Component":
        return self.__parent__._cast(_2716.Component)

    @property
    def part(self: "CastSelf") -> "_2744.Part":
        from mastapy._private.system_model.part_model import _2744

        return self.__parent__._cast(_2744.Part)

    @property
    def design_entity(self: "CastSelf") -> "_2453.DesignEntity":
        from mastapy._private.system_model import _2453

        return self.__parent__._cast(_2453.DesignEntity)

    @property
    def bearing(self: "CastSelf") -> "_2710.Bearing":
        from mastapy._private.system_model.part_model import _2710

        return self.__parent__._cast(_2710.Bearing)

    @property
    def connector(self: "CastSelf") -> "_2719.Connector":
        from mastapy._private.system_model.part_model import _2719

        return self.__parent__._cast(_2719.Connector)

    @property
    def mass_disc(self: "CastSelf") -> "_2735.MassDisc":
        from mastapy._private.system_model.part_model import _2735

        return self.__parent__._cast(_2735.MassDisc)

    @property
    def measurement_component(self: "CastSelf") -> "_2736.MeasurementComponent":
        from mastapy._private.system_model.part_model import _2736

        return self.__parent__._cast(_2736.MeasurementComponent)

    @property
    def oil_seal(self: "CastSelf") -> "_2741.OilSeal":
        from mastapy._private.system_model.part_model import _2741

        return self.__parent__._cast(_2741.OilSeal)

    @property
    def planet_carrier(self: "CastSelf") -> "_2746.PlanetCarrier":
        from mastapy._private.system_model.part_model import _2746

        return self.__parent__._cast(_2746.PlanetCarrier)

    @property
    def point_load(self: "CastSelf") -> "_2748.PointLoad":
        from mastapy._private.system_model.part_model import _2748

        return self.__parent__._cast(_2748.PointLoad)

    @property
    def power_load(self: "CastSelf") -> "_2749.PowerLoad":
        from mastapy._private.system_model.part_model import _2749

        return self.__parent__._cast(_2749.PowerLoad)

    @property
    def unbalanced_mass(self: "CastSelf") -> "_2755.UnbalancedMass":
        from mastapy._private.system_model.part_model import _2755

        return self.__parent__._cast(_2755.UnbalancedMass)

    @property
    def virtual_component(self: "CastSelf") -> "_2757.VirtualComponent":
        from mastapy._private.system_model.part_model import _2757

        return self.__parent__._cast(_2757.VirtualComponent)

    @property
    def agma_gleason_conical_gear(self: "CastSelf") -> "_2796.AGMAGleasonConicalGear":
        from mastapy._private.system_model.part_model.gears import _2796

        return self.__parent__._cast(_2796.AGMAGleasonConicalGear)

    @property
    def bevel_differential_gear(self: "CastSelf") -> "_2798.BevelDifferentialGear":
        from mastapy._private.system_model.part_model.gears import _2798

        return self.__parent__._cast(_2798.BevelDifferentialGear)

    @property
    def bevel_differential_planet_gear(
        self: "CastSelf",
    ) -> "_2800.BevelDifferentialPlanetGear":
        from mastapy._private.system_model.part_model.gears import _2800

        return self.__parent__._cast(_2800.BevelDifferentialPlanetGear)

    @property
    def bevel_differential_sun_gear(
        self: "CastSelf",
    ) -> "_2801.BevelDifferentialSunGear":
        from mastapy._private.system_model.part_model.gears import _2801

        return self.__parent__._cast(_2801.BevelDifferentialSunGear)

    @property
    def bevel_gear(self: "CastSelf") -> "_2802.BevelGear":
        from mastapy._private.system_model.part_model.gears import _2802

        return self.__parent__._cast(_2802.BevelGear)

    @property
    def concept_gear(self: "CastSelf") -> "_2804.ConceptGear":
        from mastapy._private.system_model.part_model.gears import _2804

        return self.__parent__._cast(_2804.ConceptGear)

    @property
    def conical_gear(self: "CastSelf") -> "_2806.ConicalGear":
        from mastapy._private.system_model.part_model.gears import _2806

        return self.__parent__._cast(_2806.ConicalGear)

    @property
    def cylindrical_gear(self: "CastSelf") -> "_2808.CylindricalGear":
        from mastapy._private.system_model.part_model.gears import _2808

        return self.__parent__._cast(_2808.CylindricalGear)

    @property
    def cylindrical_planet_gear(self: "CastSelf") -> "_2810.CylindricalPlanetGear":
        from mastapy._private.system_model.part_model.gears import _2810

        return self.__parent__._cast(_2810.CylindricalPlanetGear)

    @property
    def face_gear(self: "CastSelf") -> "_2811.FaceGear":
        from mastapy._private.system_model.part_model.gears import _2811

        return self.__parent__._cast(_2811.FaceGear)

    @property
    def gear(self: "CastSelf") -> "_2813.Gear":
        from mastapy._private.system_model.part_model.gears import _2813

        return self.__parent__._cast(_2813.Gear)

    @property
    def hypoid_gear(self: "CastSelf") -> "_2817.HypoidGear":
        from mastapy._private.system_model.part_model.gears import _2817

        return self.__parent__._cast(_2817.HypoidGear)

    @property
    def klingelnberg_cyclo_palloid_conical_gear(
        self: "CastSelf",
    ) -> "_2819.KlingelnbergCycloPalloidConicalGear":
        from mastapy._private.system_model.part_model.gears import _2819

        return self.__parent__._cast(_2819.KlingelnbergCycloPalloidConicalGear)

    @property
    def klingelnberg_cyclo_palloid_hypoid_gear(
        self: "CastSelf",
    ) -> "_2821.KlingelnbergCycloPalloidHypoidGear":
        from mastapy._private.system_model.part_model.gears import _2821

        return self.__parent__._cast(_2821.KlingelnbergCycloPalloidHypoidGear)

    @property
    def klingelnberg_cyclo_palloid_spiral_bevel_gear(
        self: "CastSelf",
    ) -> "_2823.KlingelnbergCycloPalloidSpiralBevelGear":
        from mastapy._private.system_model.part_model.gears import _2823

        return self.__parent__._cast(_2823.KlingelnbergCycloPalloidSpiralBevelGear)

    @property
    def spiral_bevel_gear(self: "CastSelf") -> "_2827.SpiralBevelGear":
        from mastapy._private.system_model.part_model.gears import _2827

        return self.__parent__._cast(_2827.SpiralBevelGear)

    @property
    def straight_bevel_diff_gear(self: "CastSelf") -> "_2829.StraightBevelDiffGear":
        from mastapy._private.system_model.part_model.gears import _2829

        return self.__parent__._cast(_2829.StraightBevelDiffGear)

    @property
    def straight_bevel_gear(self: "CastSelf") -> "_2831.StraightBevelGear":
        from mastapy._private.system_model.part_model.gears import _2831

        return self.__parent__._cast(_2831.StraightBevelGear)

    @property
    def straight_bevel_planet_gear(self: "CastSelf") -> "_2833.StraightBevelPlanetGear":
        from mastapy._private.system_model.part_model.gears import _2833

        return self.__parent__._cast(_2833.StraightBevelPlanetGear)

    @property
    def straight_bevel_sun_gear(self: "CastSelf") -> "_2834.StraightBevelSunGear":
        from mastapy._private.system_model.part_model.gears import _2834

        return self.__parent__._cast(_2834.StraightBevelSunGear)

    @property
    def worm_gear(self: "CastSelf") -> "_2835.WormGear":
        from mastapy._private.system_model.part_model.gears import _2835

        return self.__parent__._cast(_2835.WormGear)

    @property
    def zerol_bevel_gear(self: "CastSelf") -> "_2837.ZerolBevelGear":
        from mastapy._private.system_model.part_model.gears import _2837

        return self.__parent__._cast(_2837.ZerolBevelGear)

    @property
    def ring_pins(self: "CastSelf") -> "_2854.RingPins":
        from mastapy._private.system_model.part_model.cycloidal import _2854

        return self.__parent__._cast(_2854.RingPins)

    @property
    def clutch_half(self: "CastSelf") -> "_2864.ClutchHalf":
        from mastapy._private.system_model.part_model.couplings import _2864

        return self.__parent__._cast(_2864.ClutchHalf)

    @property
    def concept_coupling_half(self: "CastSelf") -> "_2867.ConceptCouplingHalf":
        from mastapy._private.system_model.part_model.couplings import _2867

        return self.__parent__._cast(_2867.ConceptCouplingHalf)

    @property
    def coupling_half(self: "CastSelf") -> "_2870.CouplingHalf":
        from mastapy._private.system_model.part_model.couplings import _2870

        return self.__parent__._cast(_2870.CouplingHalf)

    @property
    def cvt_pulley(self: "CastSelf") -> "_2873.CVTPulley":
        from mastapy._private.system_model.part_model.couplings import _2873

        return self.__parent__._cast(_2873.CVTPulley)

    @property
    def part_to_part_shear_coupling_half(
        self: "CastSelf",
    ) -> "_2875.PartToPartShearCouplingHalf":
        from mastapy._private.system_model.part_model.couplings import _2875

        return self.__parent__._cast(_2875.PartToPartShearCouplingHalf)

    @property
    def pulley(self: "CastSelf") -> "_2877.Pulley":
        from mastapy._private.system_model.part_model.couplings import _2877

        return self.__parent__._cast(_2877.Pulley)

    @property
    def rolling_ring(self: "CastSelf") -> "_2884.RollingRing":
        from mastapy._private.system_model.part_model.couplings import _2884

        return self.__parent__._cast(_2884.RollingRing)

    @property
    def shaft_hub_connection(self: "CastSelf") -> "_2886.ShaftHubConnection":
        from mastapy._private.system_model.part_model.couplings import _2886

        return self.__parent__._cast(_2886.ShaftHubConnection)

    @property
    def spring_damper_half(self: "CastSelf") -> "_2893.SpringDamperHalf":
        from mastapy._private.system_model.part_model.couplings import _2893

        return self.__parent__._cast(_2893.SpringDamperHalf)

    @property
    def synchroniser_half(self: "CastSelf") -> "_2896.SynchroniserHalf":
        from mastapy._private.system_model.part_model.couplings import _2896

        return self.__parent__._cast(_2896.SynchroniserHalf)

    @property
    def synchroniser_part(self: "CastSelf") -> "_2897.SynchroniserPart":
        from mastapy._private.system_model.part_model.couplings import _2897

        return self.__parent__._cast(_2897.SynchroniserPart)

    @property
    def synchroniser_sleeve(self: "CastSelf") -> "_2898.SynchroniserSleeve":
        from mastapy._private.system_model.part_model.couplings import _2898

        return self.__parent__._cast(_2898.SynchroniserSleeve)

    @property
    def torque_converter_pump(self: "CastSelf") -> "_2900.TorqueConverterPump":
        from mastapy._private.system_model.part_model.couplings import _2900

        return self.__parent__._cast(_2900.TorqueConverterPump)

    @property
    def torque_converter_turbine(self: "CastSelf") -> "_2902.TorqueConverterTurbine":
        from mastapy._private.system_model.part_model.couplings import _2902

        return self.__parent__._cast(_2902.TorqueConverterTurbine)

    @property
    def mountable_component(self: "CastSelf") -> "MountableComponent":
        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 MountableComponent(_2716.Component):
    """MountableComponent

    This is a mastapy class.
    """

    TYPE: ClassVar["Type"] = _MOUNTABLE_COMPONENT

    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 rotation_about_axis(self: "Self") -> "float":
        """float"""
        temp = pythonnet_property_get(self.wrapped, "RotationAboutAxis")

        if temp is None:
            return 0.0

        return temp

    @rotation_about_axis.setter
    @exception_bridge
    @enforce_parameter_types
    def rotation_about_axis(self: "Self", value: "float") -> None:
        pythonnet_property_set(
            self.wrapped,
            "RotationAboutAxis",
            float(value) if value is not None else 0.0,
        )

    @property
    @exception_bridge
    def inner_component(self: "Self") -> "_2706.AbstractShaft":
        """mastapy.system_model.part_model.AbstractShaft

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

        if temp is None:
            return None

        type_ = temp.GetType()
        return constructor.new(type_.Namespace, type_.Name)(temp)

    @property
    @exception_bridge
    def inner_connection(self: "Self") -> "_2533.Connection":
        """mastapy.system_model.connections_and_sockets.Connection

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

        if temp is None:
            return None

        type_ = temp.GetType()
        return constructor.new(type_.Namespace, type_.Name)(temp)

    @property
    @exception_bridge
    def inner_socket(self: "Self") -> "_2537.CylindricalSocket":
        """mastapy.system_model.connections_and_sockets.CylindricalSocket

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

        if temp is None:
            return None

        type_ = temp.GetType()
        return constructor.new(type_.Namespace, type_.Name)(temp)

    @property
    @exception_bridge
    def is_mounted(self: "Self") -> "bool":
        """bool

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

        if temp is None:
            return False

        return temp

    @exception_bridge
    @enforce_parameter_types
    def mount_on(
        self: "Self", shaft: "_2706.AbstractShaft", offset: "float" = float("nan")
    ) -> "_2530.CoaxialConnection":
        """mastapy.system_model.connections_and_sockets.CoaxialConnection

        Args:
            shaft (mastapy.system_model.part_model.AbstractShaft)
            offset (float, optional)
        """
        offset = float(offset)
        method_result = pythonnet_method_call(
            self.wrapped,
            "MountOn",
            shaft.wrapped if shaft else None,
            offset if offset else 0.0,
        )
        if method_result is None:
            return None

        type_ = method_result.GetType()
        return constructor.new(type_.Namespace, type_.Name)(method_result)

    @exception_bridge
    @enforce_parameter_types
    def try_mount_on(
        self: "Self", shaft: "_2706.AbstractShaft", offset: "float" = float("nan")
    ) -> "_2717.ComponentsConnectedResult":
        """mastapy.system_model.part_model.ComponentsConnectedResult

        Args:
            shaft (mastapy.system_model.part_model.AbstractShaft)
            offset (float, optional)
        """
        offset = float(offset)
        method_result = pythonnet_method_call(
            self.wrapped,
            "TryMountOn",
            shaft.wrapped if shaft else None,
            offset if offset else 0.0,
        )
        if method_result is None:
            return None

        type_ = method_result.GetType()
        return constructor.new(type_.Namespace, type_.Name)(method_result)

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

        Returns:
            _Cast_MountableComponent
        """
        return _Cast_MountableComponent(self)
