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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel


class AuthFieldSchema(UniversalBaseModel):
    """
    Schema for a single credential field.
    """

    name: str = pydantic.Field()
    """
    Field name (used as key in submission)
    """

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

    type: typing.Optional[str] = pydantic.Field(default=None)
    """
    Field type: string, password, number, boolean
    """

    required: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Whether the field is required
    """

    default: typing.Optional[typing.Any] = pydantic.Field(default=None)
    """
    Default value if any
    """

    placeholder: typing.Optional[str] = pydantic.Field(default=None)
    """
    Placeholder text for the UI
    """

    description: typing.Optional[str] = pydantic.Field(default=None)
    """
    Help text for the field
    """

    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
