"""SimpleThermalNodeBase"""

from __future__ import annotations

from typing import TYPE_CHECKING, ClassVar

from mastapy._private._internal import utility
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,
    pythonnet_property_set,
)
from mastapy._private._internal.type_enforcement import enforce_parameter_types
from mastapy._private.nodal_analysis.lumped_parameter_thermal_analysis import _210

_SIMPLE_THERMAL_NODE_BASE = python_net_import(
    "SMT.MastaAPI.NodalAnalysis.LumpedParameterThermalAnalysis", "SimpleThermalNodeBase"
)

if TYPE_CHECKING:
    from typing import Any, Type, TypeVar

    from mastapy._private.nodal_analysis.lumped_parameter_thermal_analysis import (
        _180,
        _181,
        _185,
        _198,
        _201,
        _211,
        _227,
    )

    Self = TypeVar("Self", bound="SimpleThermalNodeBase")
    CastSelf = TypeVar(
        "CastSelf", bound="SimpleThermalNodeBase._Cast_SimpleThermalNodeBase"
    )


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


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

    __parent__: "SimpleThermalNodeBase"

    @property
    def simple_node(self: "CastSelf") -> "_210.SimpleNode":
        return self.__parent__._cast(_210.SimpleNode)

    @property
    def auto_generated_simple_fluid_thermal_node(
        self: "CastSelf",
    ) -> "_180.AutoGeneratedSimpleFluidThermalNode":
        from mastapy._private.nodal_analysis.lumped_parameter_thermal_analysis import (
            _180,
        )

        return self.__parent__._cast(_180.AutoGeneratedSimpleFluidThermalNode)

    @property
    def auto_generated_simple_thermal_node(
        self: "CastSelf",
    ) -> "_181.AutoGeneratedSimpleThermalNode":
        from mastapy._private.nodal_analysis.lumped_parameter_thermal_analysis import (
            _181,
        )

        return self.__parent__._cast(_181.AutoGeneratedSimpleThermalNode)

    @property
    def channel_face_thermal_node(self: "CastSelf") -> "_185.ChannelFaceThermalNode":
        from mastapy._private.nodal_analysis.lumped_parameter_thermal_analysis import (
            _185,
        )

        return self.__parent__._cast(_185.ChannelFaceThermalNode)

    @property
    def face_node(self: "CastSelf") -> "_198.FaceNode":
        from mastapy._private.nodal_analysis.lumped_parameter_thermal_analysis import (
            _198,
        )

        return self.__parent__._cast(_198.FaceNode)

    @property
    def fe_simple_thermal_node(self: "CastSelf") -> "_201.FESimpleThermalNode":
        from mastapy._private.nodal_analysis.lumped_parameter_thermal_analysis import (
            _201,
        )

        return self.__parent__._cast(_201.FESimpleThermalNode)

    @property
    def simple_thermal_node(self: "CastSelf") -> "_211.SimpleThermalNode":
        from mastapy._private.nodal_analysis.lumped_parameter_thermal_analysis import (
            _211,
        )

        return self.__parent__._cast(_211.SimpleThermalNode)

    @property
    def user_defined_simple_thermal_node(
        self: "CastSelf",
    ) -> "_227.UserDefinedSimpleThermalNode":
        from mastapy._private.nodal_analysis.lumped_parameter_thermal_analysis import (
            _227,
        )

        return self.__parent__._cast(_227.UserDefinedSimpleThermalNode)

    @property
    def simple_thermal_node_base(self: "CastSelf") -> "SimpleThermalNodeBase":
        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 SimpleThermalNodeBase(_210.SimpleNode):
    """SimpleThermalNodeBase

    This is a mastapy class.
    """

    TYPE: ClassVar["Type"] = _SIMPLE_THERMAL_NODE_BASE

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

        if temp is None:
            return 0.0

        return temp

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

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

        Returns:
            _Cast_SimpleThermalNodeBase
        """
        return _Cast_SimpleThermalNodeBase(self)
