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

import enum
import typing

T_Result = typing.TypeVar("T_Result")


class AggregateExprFunc(str, enum.Enum):
    """
    ℹ️ This enum is non-exhaustive.
    """

    MEAN = "mean"
    MIN = "min"
    MAX = "max"
    SUM = "sum"
    COUNT = "count"
    MEDIAN = "median"
    STDDEV = "stddev"
    OLDEST = "oldest"
    NEWEST = "newest"
    _UNKNOWN = "__AGGREGATEEXPRFUNC_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) -> "AggregateExprFunc":
        unknown = cls._UNKNOWN
        unknown._value_ = value
        return unknown

    def visit(
        self,
        mean: typing.Callable[[], T_Result],
        min: typing.Callable[[], T_Result],
        max: typing.Callable[[], T_Result],
        sum: typing.Callable[[], T_Result],
        count: typing.Callable[[], T_Result],
        median: typing.Callable[[], T_Result],
        stddev: typing.Callable[[], T_Result],
        oldest: typing.Callable[[], T_Result],
        newest: typing.Callable[[], T_Result],
        _unknown_member: typing.Callable[[str], T_Result],
    ) -> T_Result:
        if self is AggregateExprFunc.MEAN:
            return mean()
        if self is AggregateExprFunc.MIN:
            return min()
        if self is AggregateExprFunc.MAX:
            return max()
        if self is AggregateExprFunc.SUM:
            return sum()
        if self is AggregateExprFunc.COUNT:
            return count()
        if self is AggregateExprFunc.MEDIAN:
            return median()
        if self is AggregateExprFunc.STDDEV:
            return stddev()
        if self is AggregateExprFunc.OLDEST:
            return oldest()
        if self is AggregateExprFunc.NEWEST:
            return newest()
        return _unknown_member(self._value_)
