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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .editor_field_option import EditorFieldOption
from .editor_field_validation import EditorFieldValidation


class EditorField(UniversalBaseModel):
    """
    Single field definition in the editor schema.
    """

    key: str = pydantic.Field()
    """
    Dot-path field key, e.g. 'tool_configurations.system_tools.web_search'
    """

    type: str = pydantic.Field()
    """
    Field type (text, slider, toggle, tool_toggle, select, etc.)
    """

    label: str = pydantic.Field()
    """
    Human-readable label
    """

    hint: typing.Optional[str] = None
    required: typing.Optional[bool] = None
    visible: typing.Optional[bool] = None
    editable: typing.Optional[bool] = None
    default: typing.Optional[typing.Any] = None
    nullable: typing.Optional[bool] = None
    validation: typing.Optional[EditorFieldValidation] = None
    options: typing.Optional[typing.List[EditorFieldOption]] = None
    options_endpoint: typing.Optional[str] = None
    visible_when: typing.Optional[typing.Dict[str, typing.Any]] = None
    create_only: typing.Optional[bool] = None
    edit_only: typing.Optional[bool] = None
    conflicts_with: typing.Optional[str] = None
    exclude_self: typing.Optional[bool] = None
    modes: typing.Optional[typing.List[str]] = None
    is_preview: typing.Optional[bool] = None
    parameters: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = None
    resource_type: typing.Optional[str] = None
    grouped_by: typing.Optional[str] = None
    read_only: typing.Optional[bool] = None
    data_endpoint: typing.Optional[str] = None

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
