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

import typing

from ..core import enum

T_Result = typing.TypeVar("T_Result")


class EditJsonExtendEditFieldType(enum.StrEnum):
    """
    The PDF field type to edit. Allowed values depend on the schema type:
    * `["string", "null"]` → `text`, `signature`
    * `["number", "null"]` → `text`
    * `["integer", "null"]` → `text`
    * `["boolean", "null"]` → `checkbox`, `radio`
    * `"array"` → `text`, `table`
    * `"object"` → `signature`
    * enum fields (no type) → `radio`, `optionList`, `dropdown`
    """

    TEXT = "text"
    CHECKBOX = "checkbox"
    RADIO = "radio"
    DROPDOWN = "dropdown"
    OPTION_LIST = "optionList"
    SIGNATURE = "signature"
    TABLE = "table"
    UNKNOWN = "unknown"
    _UNKNOWN = "__EDITJSONEXTENDEDITFIELDTYPE_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) -> "EditJsonExtendEditFieldType":
        unknown = cls._UNKNOWN
        unknown._value_ = value
        return unknown

    def visit(
        self,
        text: typing.Callable[[], T_Result],
        checkbox: typing.Callable[[], T_Result],
        radio: typing.Callable[[], T_Result],
        dropdown: typing.Callable[[], T_Result],
        option_list: typing.Callable[[], T_Result],
        signature: typing.Callable[[], T_Result],
        table: typing.Callable[[], T_Result],
        unknown: typing.Callable[[], T_Result],
        _unknown_member: typing.Callable[[str], T_Result],
    ) -> T_Result:
        if self is EditJsonExtendEditFieldType.TEXT:
            return text()
        if self is EditJsonExtendEditFieldType.CHECKBOX:
            return checkbox()
        if self is EditJsonExtendEditFieldType.RADIO:
            return radio()
        if self is EditJsonExtendEditFieldType.DROPDOWN:
            return dropdown()
        if self is EditJsonExtendEditFieldType.OPTION_LIST:
            return option_list()
        if self is EditJsonExtendEditFieldType.SIGNATURE:
            return signature()
        if self is EditJsonExtendEditFieldType.TABLE:
            return table()
        if self is EditJsonExtendEditFieldType.UNKNOWN:
            return unknown()
        return _unknown_member(self._value_)
