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

import typing

from ..core import enum

T_Result = typing.TypeVar("T_Result")


class LegacyExtractionFieldType(enum.StrEnum):
    """
    The type of the field.
    """

    STRING = "string"
    NUMBER = "number"
    CURRENCY = "currency"
    BOOLEAN = "boolean"
    DATE = "date"
    ARRAY = "array"
    ENUM = "enum"
    OBJECT = "object"
    SIGNATURE = "signature"
    _UNKNOWN = "__LEGACYEXTRACTIONFIELDTYPE_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) -> "LegacyExtractionFieldType":
        unknown = cls._UNKNOWN
        unknown._value_ = value
        return unknown

    def visit(
        self,
        string: typing.Callable[[], T_Result],
        number: typing.Callable[[], T_Result],
        currency: typing.Callable[[], T_Result],
        boolean: typing.Callable[[], T_Result],
        date: typing.Callable[[], T_Result],
        array: typing.Callable[[], T_Result],
        enum: typing.Callable[[], T_Result],
        object: typing.Callable[[], T_Result],
        signature: typing.Callable[[], T_Result],
        _unknown_member: typing.Callable[[str], T_Result],
    ) -> T_Result:
        if self is LegacyExtractionFieldType.STRING:
            return string()
        if self is LegacyExtractionFieldType.NUMBER:
            return number()
        if self is LegacyExtractionFieldType.CURRENCY:
            return currency()
        if self is LegacyExtractionFieldType.BOOLEAN:
            return boolean()
        if self is LegacyExtractionFieldType.DATE:
            return date()
        if self is LegacyExtractionFieldType.ARRAY:
            return array()
        if self is LegacyExtractionFieldType.ENUM:
            return enum()
        if self is LegacyExtractionFieldType.OBJECT:
            return object()
        if self is LegacyExtractionFieldType.SIGNATURE:
            return signature()
        return _unknown_member(self._value_)
