"""AutoGeneratedThermalConnectorWithResistance"""

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.exceptions import CastException
from mastapy._private._internal.python_net import python_net_import
from mastapy._private.nodal_analysis.lumped_parameter_thermal_analysis import _217

_AUTO_GENERATED_THERMAL_CONNECTOR_WITH_RESISTANCE = python_net_import(
    "SMT.MastaAPI.NodalAnalysis.LumpedParameterThermalAnalysis",
    "AutoGeneratedThermalConnectorWithResistance",
)

if TYPE_CHECKING:
    from typing import Any, Type, TypeVar

    from mastapy._private.nodal_analysis.lumped_parameter_thermal_analysis import _215

    Self = TypeVar("Self", bound="AutoGeneratedThermalConnectorWithResistance")
    CastSelf = TypeVar(
        "CastSelf",
        bound="AutoGeneratedThermalConnectorWithResistance._Cast_AutoGeneratedThermalConnectorWithResistance",
    )


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


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

    __parent__: "AutoGeneratedThermalConnectorWithResistance"

    @property
    def thermal_connector_with_resistance(
        self: "CastSelf",
    ) -> "_217.ThermalConnectorWithResistance":
        return self.__parent__._cast(_217.ThermalConnectorWithResistance)

    @property
    def thermal_connector(self: "CastSelf") -> "_215.ThermalConnector":
        from mastapy._private.nodal_analysis.lumped_parameter_thermal_analysis import (
            _215,
        )

        return self.__parent__._cast(_215.ThermalConnector)

    @property
    def auto_generated_thermal_connector_with_resistance(
        self: "CastSelf",
    ) -> "AutoGeneratedThermalConnectorWithResistance":
        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 AutoGeneratedThermalConnectorWithResistance(_217.ThermalConnectorWithResistance):
    """AutoGeneratedThermalConnectorWithResistance

    This is a mastapy class.
    """

    TYPE: ClassVar["Type"] = _AUTO_GENERATED_THERMAL_CONNECTOR_WITH_RESISTANCE

    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
    def cast_to(self: "Self") -> "_Cast_AutoGeneratedThermalConnectorWithResistance":
        """Cast to another type.

        Returns:
            _Cast_AutoGeneratedThermalConnectorWithResistance
        """
        return _Cast_AutoGeneratedThermalConnectorWithResistance(self)
