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

from ...core.pydantic_utilities import UniversalBaseModel
import pydantic
import typing
from .action_parameter_type import ActionParameterType
import typing_extensions
from .action_enum_option import ActionEnumOption
from ...core.serialization import FieldMetadata
from ...core.pydantic_utilities import IS_PYDANTIC_V2


class ActionParameter(UniversalBaseModel):
    id: str = pydantic.Field()
    """
    The ID field will be used when parameters are supplied to `executeAction`.
    """

    label: str = pydantic.Field()
    """
    The title of the field that will be shown on action forms.
    """

    description: str = pydantic.Field()
    """
    A longer description of the field which will be shown in smaller text near the label on action forms.
    """

    required: bool = pydantic.Field()
    """
    Whether the field is required for action execution.
    """

    type: typing.Optional[ActionParameterType] = pydantic.Field(default=None)
    """
    The parameter type. Values provided to `executeAction` will conform to this type. Defaults to `STRING`.
    """

    enum_options: typing_extensions.Annotated[
        typing.Optional[typing.List[ActionEnumOption]], FieldMetadata(alias="enumOptions")
    ] = pydantic.Field(default=None)
    """
    Restricts the action parameter to only the options in this list. Valid for type `STRING`, `BOOLEAN`, and `NUMBER`.
    """

    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
