# This file was auto-generated by Fern from our API Definition.

import enum
import typing

T_Result = typing.TypeVar("T_Result")


class Relationship(str, enum.Enum):
    SELF = "SELF"
    SPOUSE = "SPOUSE"
    CHILD = "CHILD"
    COMMON_LAW_SPOUSE = "COMMON_LAW_SPOUSE"
    OTHER = "OTHER"
    _UNKNOWN = "__RELATIONSHIP_UNKNOWN__"
    """
    This member is used for forward compatibility. If the value is not recognized by the enum, it will be stored here, and the raw value is accessible through `.value`.
    """

    @classmethod
    def _missing_(cls, value: typing.Any) -> "Relationship":
        unknown = cls._UNKNOWN
        unknown._value_ = value
        return unknown

    def visit(
        self,
        self_: typing.Callable[[], T_Result],
        spouse: typing.Callable[[], T_Result],
        child: typing.Callable[[], T_Result],
        common_law_spouse: typing.Callable[[], T_Result],
        other: typing.Callable[[], T_Result],
        _unknown_member: typing.Callable[[str], T_Result],
    ) -> T_Result:
        if self is Relationship.SELF:
            return self_()
        if self is Relationship.SPOUSE:
            return spouse()
        if self is Relationship.CHILD:
            return child()
        if self is Relationship.COMMON_LAW_SPOUSE:
            return common_law_spouse()
        if self is Relationship.OTHER:
            return other()
        return _unknown_member(self._value_)
