"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from documenso_sdk import utils
from documenso_sdk.types import BaseModel, Nullable, UNSET_SENTINEL
from enum import Enum
import pydantic
from pydantic import model_serializer
from typing import Any, List, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody11Type(str, Enum):
    DROPDOWN = "DROPDOWN"


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody11FieldMetaType(
    str, Enum
):
    DROPDOWN = "dropdown"


class FieldCreateDocumentFieldFieldDocumentsFieldsValuesTypedDict(TypedDict):
    value: str


class FieldCreateDocumentFieldFieldDocumentsFieldsValues(BaseModel):
    value: str


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody11FieldMetaTypedDict(
    TypedDict
):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody11FieldMetaType
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    values: NotRequired[
        List[FieldCreateDocumentFieldFieldDocumentsFieldsValuesTypedDict]
    ]
    default_value: NotRequired[str]


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody11FieldMeta(
    BaseModel
):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody11FieldMetaType

    label: Optional[str] = None

    placeholder: Optional[str] = None

    required: Optional[bool] = None

    read_only: Annotated[Optional[bool], pydantic.Field(alias="readOnly")] = None

    values: Optional[List[FieldCreateDocumentFieldFieldDocumentsFieldsValues]] = None

    default_value: Annotated[Optional[str], pydantic.Field(alias="defaultValue")] = None


class Field11TypedDict(TypedDict):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody11Type
    recipient_id: float
    r"""The ID of the recipient to create the field for."""
    page_number: float
    r"""The page number the field will be on."""
    page_x: float
    r"""The X coordinate of where the field will be placed."""
    page_y: float
    r"""The Y coordinate of where the field will be placed."""
    width: float
    r"""The width of the field."""
    height: float
    r"""The height of the field."""
    field_meta: NotRequired[
        FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody11FieldMetaTypedDict
    ]


class Field11(BaseModel):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody11Type

    recipient_id: Annotated[float, pydantic.Field(alias="recipientId")]
    r"""The ID of the recipient to create the field for."""

    page_number: Annotated[float, pydantic.Field(alias="pageNumber")]
    r"""The page number the field will be on."""

    page_x: Annotated[float, pydantic.Field(alias="pageX")]
    r"""The X coordinate of where the field will be placed."""

    page_y: Annotated[float, pydantic.Field(alias="pageY")]
    r"""The Y coordinate of where the field will be placed."""

    width: float
    r"""The width of the field."""

    height: float
    r"""The height of the field."""

    field_meta: Annotated[
        Optional[
            FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody11FieldMeta
        ],
        pydantic.Field(alias="fieldMeta"),
    ] = None


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody10Type(str, Enum):
    CHECKBOX = "CHECKBOX"


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody10FieldMetaType(
    str, Enum
):
    CHECKBOX = "checkbox"


class FieldCreateDocumentFieldFieldValuesTypedDict(TypedDict):
    id: float
    checked: bool
    value: str


class FieldCreateDocumentFieldFieldValues(BaseModel):
    id: float

    checked: bool

    value: str


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody10FieldMetaTypedDict(
    TypedDict
):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody10FieldMetaType
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    values: NotRequired[List[FieldCreateDocumentFieldFieldValuesTypedDict]]
    validation_rule: NotRequired[str]
    validation_length: NotRequired[float]


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody10FieldMeta(
    BaseModel
):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody10FieldMetaType

    label: Optional[str] = None

    placeholder: Optional[str] = None

    required: Optional[bool] = None

    read_only: Annotated[Optional[bool], pydantic.Field(alias="readOnly")] = None

    values: Optional[List[FieldCreateDocumentFieldFieldValues]] = None

    validation_rule: Annotated[
        Optional[str], pydantic.Field(alias="validationRule")
    ] = None

    validation_length: Annotated[
        Optional[float], pydantic.Field(alias="validationLength")
    ] = None


class Field10TypedDict(TypedDict):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody10Type
    recipient_id: float
    r"""The ID of the recipient to create the field for."""
    page_number: float
    r"""The page number the field will be on."""
    page_x: float
    r"""The X coordinate of where the field will be placed."""
    page_y: float
    r"""The Y coordinate of where the field will be placed."""
    width: float
    r"""The width of the field."""
    height: float
    r"""The height of the field."""
    field_meta: NotRequired[
        FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody10FieldMetaTypedDict
    ]


class Field10(BaseModel):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody10Type

    recipient_id: Annotated[float, pydantic.Field(alias="recipientId")]
    r"""The ID of the recipient to create the field for."""

    page_number: Annotated[float, pydantic.Field(alias="pageNumber")]
    r"""The page number the field will be on."""

    page_x: Annotated[float, pydantic.Field(alias="pageX")]
    r"""The X coordinate of where the field will be placed."""

    page_y: Annotated[float, pydantic.Field(alias="pageY")]
    r"""The Y coordinate of where the field will be placed."""

    width: float
    r"""The width of the field."""

    height: float
    r"""The height of the field."""

    field_meta: Annotated[
        Optional[
            FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody10FieldMeta
        ],
        pydantic.Field(alias="fieldMeta"),
    ] = None


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody9Type(str, Enum):
    RADIO = "RADIO"


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody9FieldMetaType(
    str, Enum
):
    RADIO = "radio"


class FieldValuesTypedDict(TypedDict):
    id: float
    checked: bool
    value: str


class FieldValues(BaseModel):
    id: float

    checked: bool

    value: str


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody9FieldMetaTypedDict(
    TypedDict
):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody9FieldMetaType
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    values: NotRequired[List[FieldValuesTypedDict]]


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody9FieldMeta(
    BaseModel
):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody9FieldMetaType

    label: Optional[str] = None

    placeholder: Optional[str] = None

    required: Optional[bool] = None

    read_only: Annotated[Optional[bool], pydantic.Field(alias="readOnly")] = None

    values: Optional[List[FieldValues]] = None


class Field9TypedDict(TypedDict):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody9Type
    recipient_id: float
    r"""The ID of the recipient to create the field for."""
    page_number: float
    r"""The page number the field will be on."""
    page_x: float
    r"""The X coordinate of where the field will be placed."""
    page_y: float
    r"""The Y coordinate of where the field will be placed."""
    width: float
    r"""The width of the field."""
    height: float
    r"""The height of the field."""
    field_meta: NotRequired[
        FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody9FieldMetaTypedDict
    ]


class Field9(BaseModel):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody9Type

    recipient_id: Annotated[float, pydantic.Field(alias="recipientId")]
    r"""The ID of the recipient to create the field for."""

    page_number: Annotated[float, pydantic.Field(alias="pageNumber")]
    r"""The page number the field will be on."""

    page_x: Annotated[float, pydantic.Field(alias="pageX")]
    r"""The X coordinate of where the field will be placed."""

    page_y: Annotated[float, pydantic.Field(alias="pageY")]
    r"""The Y coordinate of where the field will be placed."""

    width: float
    r"""The width of the field."""

    height: float
    r"""The height of the field."""

    field_meta: Annotated[
        Optional[
            FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody9FieldMeta
        ],
        pydantic.Field(alias="fieldMeta"),
    ] = None


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody8Type(str, Enum):
    NUMBER = "NUMBER"


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody8FieldMetaType(
    str, Enum
):
    NUMBER = "number"


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody8FieldMetaTypedDict(
    TypedDict
):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody8FieldMetaType
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    number_format: NotRequired[str]
    value: NotRequired[str]
    min_value: NotRequired[float]
    max_value: NotRequired[float]
    font_size: NotRequired[float]


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody8FieldMeta(
    BaseModel
):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody8FieldMetaType

    label: Optional[str] = None

    placeholder: Optional[str] = None

    required: Optional[bool] = None

    read_only: Annotated[Optional[bool], pydantic.Field(alias="readOnly")] = None

    number_format: Annotated[Optional[str], pydantic.Field(alias="numberFormat")] = None

    value: Optional[str] = None

    min_value: Annotated[Optional[float], pydantic.Field(alias="minValue")] = None

    max_value: Annotated[Optional[float], pydantic.Field(alias="maxValue")] = None

    font_size: Annotated[Optional[float], pydantic.Field(alias="fontSize")] = None


class Field8TypedDict(TypedDict):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody8Type
    recipient_id: float
    r"""The ID of the recipient to create the field for."""
    page_number: float
    r"""The page number the field will be on."""
    page_x: float
    r"""The X coordinate of where the field will be placed."""
    page_y: float
    r"""The Y coordinate of where the field will be placed."""
    width: float
    r"""The width of the field."""
    height: float
    r"""The height of the field."""
    field_meta: NotRequired[
        FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody8FieldMetaTypedDict
    ]


class Field8(BaseModel):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody8Type

    recipient_id: Annotated[float, pydantic.Field(alias="recipientId")]
    r"""The ID of the recipient to create the field for."""

    page_number: Annotated[float, pydantic.Field(alias="pageNumber")]
    r"""The page number the field will be on."""

    page_x: Annotated[float, pydantic.Field(alias="pageX")]
    r"""The X coordinate of where the field will be placed."""

    page_y: Annotated[float, pydantic.Field(alias="pageY")]
    r"""The Y coordinate of where the field will be placed."""

    width: float
    r"""The width of the field."""

    height: float
    r"""The height of the field."""

    field_meta: Annotated[
        Optional[
            FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody8FieldMeta
        ],
        pydantic.Field(alias="fieldMeta"),
    ] = None


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody7Type(str, Enum):
    TEXT = "TEXT"


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody7FieldMetaType(
    str, Enum
):
    TEXT = "text"


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBodyFieldMetaTypedDict(
    TypedDict
):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody7FieldMetaType
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    text: NotRequired[str]
    character_limit: NotRequired[float]
    font_size: NotRequired[float]


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBodyFieldMeta(
    BaseModel
):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody7FieldMetaType

    label: Optional[str] = None

    placeholder: Optional[str] = None

    required: Optional[bool] = None

    read_only: Annotated[Optional[bool], pydantic.Field(alias="readOnly")] = None

    text: Optional[str] = None

    character_limit: Annotated[
        Optional[float], pydantic.Field(alias="characterLimit")
    ] = None

    font_size: Annotated[Optional[float], pydantic.Field(alias="fontSize")] = None


class Field7TypedDict(TypedDict):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody7Type
    recipient_id: float
    r"""The ID of the recipient to create the field for."""
    page_number: float
    r"""The page number the field will be on."""
    page_x: float
    r"""The X coordinate of where the field will be placed."""
    page_y: float
    r"""The Y coordinate of where the field will be placed."""
    width: float
    r"""The width of the field."""
    height: float
    r"""The height of the field."""
    field_meta: NotRequired[
        FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBodyFieldMetaTypedDict
    ]


class Field7(BaseModel):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody7Type

    recipient_id: Annotated[float, pydantic.Field(alias="recipientId")]
    r"""The ID of the recipient to create the field for."""

    page_number: Annotated[float, pydantic.Field(alias="pageNumber")]
    r"""The page number the field will be on."""

    page_x: Annotated[float, pydantic.Field(alias="pageX")]
    r"""The X coordinate of where the field will be placed."""

    page_y: Annotated[float, pydantic.Field(alias="pageY")]
    r"""The Y coordinate of where the field will be placed."""

    width: float
    r"""The width of the field."""

    height: float
    r"""The height of the field."""

    field_meta: Annotated[
        Optional[
            FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBodyFieldMeta
        ],
        pydantic.Field(alias="fieldMeta"),
    ] = None


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody6Type(str, Enum):
    DATE = "DATE"


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody6FieldMetaType(
    str, Enum
):
    DATE = "date"


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestFieldMetaTypedDict(TypedDict):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody6FieldMetaType
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    font_size: NotRequired[float]


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestFieldMeta(BaseModel):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody6FieldMetaType

    label: Optional[str] = None

    placeholder: Optional[str] = None

    required: Optional[bool] = None

    read_only: Annotated[Optional[bool], pydantic.Field(alias="readOnly")] = None

    font_size: Annotated[Optional[float], pydantic.Field(alias="fontSize")] = None


class Field6TypedDict(TypedDict):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody6Type
    recipient_id: float
    r"""The ID of the recipient to create the field for."""
    page_number: float
    r"""The page number the field will be on."""
    page_x: float
    r"""The X coordinate of where the field will be placed."""
    page_y: float
    r"""The Y coordinate of where the field will be placed."""
    width: float
    r"""The width of the field."""
    height: float
    r"""The height of the field."""
    field_meta: NotRequired[
        FieldCreateDocumentFieldFieldDocumentsFieldsRequestFieldMetaTypedDict
    ]


class Field6(BaseModel):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody6Type

    recipient_id: Annotated[float, pydantic.Field(alias="recipientId")]
    r"""The ID of the recipient to create the field for."""

    page_number: Annotated[float, pydantic.Field(alias="pageNumber")]
    r"""The page number the field will be on."""

    page_x: Annotated[float, pydantic.Field(alias="pageX")]
    r"""The X coordinate of where the field will be placed."""

    page_y: Annotated[float, pydantic.Field(alias="pageY")]
    r"""The Y coordinate of where the field will be placed."""

    width: float
    r"""The width of the field."""

    height: float
    r"""The height of the field."""

    field_meta: Annotated[
        Optional[FieldCreateDocumentFieldFieldDocumentsFieldsRequestFieldMeta],
        pydantic.Field(alias="fieldMeta"),
    ] = None


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody5Type(str, Enum):
    EMAIL = "EMAIL"


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody5FieldMetaType(
    str, Enum
):
    EMAIL = "email"


class FieldCreateDocumentFieldFieldDocumentsFieldsFieldMetaTypedDict(TypedDict):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody5FieldMetaType
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    font_size: NotRequired[float]


class FieldCreateDocumentFieldFieldDocumentsFieldsFieldMeta(BaseModel):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody5FieldMetaType

    label: Optional[str] = None

    placeholder: Optional[str] = None

    required: Optional[bool] = None

    read_only: Annotated[Optional[bool], pydantic.Field(alias="readOnly")] = None

    font_size: Annotated[Optional[float], pydantic.Field(alias="fontSize")] = None


class Field5TypedDict(TypedDict):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody5Type
    recipient_id: float
    r"""The ID of the recipient to create the field for."""
    page_number: float
    r"""The page number the field will be on."""
    page_x: float
    r"""The X coordinate of where the field will be placed."""
    page_y: float
    r"""The Y coordinate of where the field will be placed."""
    width: float
    r"""The width of the field."""
    height: float
    r"""The height of the field."""
    field_meta: NotRequired[
        FieldCreateDocumentFieldFieldDocumentsFieldsFieldMetaTypedDict
    ]


class Field5(BaseModel):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody5Type

    recipient_id: Annotated[float, pydantic.Field(alias="recipientId")]
    r"""The ID of the recipient to create the field for."""

    page_number: Annotated[float, pydantic.Field(alias="pageNumber")]
    r"""The page number the field will be on."""

    page_x: Annotated[float, pydantic.Field(alias="pageX")]
    r"""The X coordinate of where the field will be placed."""

    page_y: Annotated[float, pydantic.Field(alias="pageY")]
    r"""The Y coordinate of where the field will be placed."""

    width: float
    r"""The width of the field."""

    height: float
    r"""The height of the field."""

    field_meta: Annotated[
        Optional[FieldCreateDocumentFieldFieldDocumentsFieldsFieldMeta],
        pydantic.Field(alias="fieldMeta"),
    ] = None


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBodyType(str, Enum):
    NAME = "NAME"


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody4Type(str, Enum):
    NAME = "name"


class FieldCreateDocumentFieldFieldFieldMetaTypedDict(TypedDict):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody4Type
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    font_size: NotRequired[float]


class FieldCreateDocumentFieldFieldFieldMeta(BaseModel):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBody4Type

    label: Optional[str] = None

    placeholder: Optional[str] = None

    required: Optional[bool] = None

    read_only: Annotated[Optional[bool], pydantic.Field(alias="readOnly")] = None

    font_size: Annotated[Optional[float], pydantic.Field(alias="fontSize")] = None


class Field4TypedDict(TypedDict):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBodyType
    recipient_id: float
    r"""The ID of the recipient to create the field for."""
    page_number: float
    r"""The page number the field will be on."""
    page_x: float
    r"""The X coordinate of where the field will be placed."""
    page_y: float
    r"""The Y coordinate of where the field will be placed."""
    width: float
    r"""The width of the field."""
    height: float
    r"""The height of the field."""
    field_meta: NotRequired[FieldCreateDocumentFieldFieldFieldMetaTypedDict]


class Field4(BaseModel):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestRequestBodyType

    recipient_id: Annotated[float, pydantic.Field(alias="recipientId")]
    r"""The ID of the recipient to create the field for."""

    page_number: Annotated[float, pydantic.Field(alias="pageNumber")]
    r"""The page number the field will be on."""

    page_x: Annotated[float, pydantic.Field(alias="pageX")]
    r"""The X coordinate of where the field will be placed."""

    page_y: Annotated[float, pydantic.Field(alias="pageY")]
    r"""The Y coordinate of where the field will be placed."""

    width: float
    r"""The width of the field."""

    height: float
    r"""The height of the field."""

    field_meta: Annotated[
        Optional[FieldCreateDocumentFieldFieldFieldMeta],
        pydantic.Field(alias="fieldMeta"),
    ] = None


class FieldCreateDocumentFieldFieldDocumentsFieldsType(str, Enum):
    INITIALS = "INITIALS"


class FieldCreateDocumentFieldFieldDocumentsFieldsRequestType(str, Enum):
    INITIALS = "initials"


class FieldFieldMetaTypedDict(TypedDict):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestType
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    font_size: NotRequired[float]


class FieldFieldMeta(BaseModel):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsRequestType

    label: Optional[str] = None

    placeholder: Optional[str] = None

    required: Optional[bool] = None

    read_only: Annotated[Optional[bool], pydantic.Field(alias="readOnly")] = None

    font_size: Annotated[Optional[float], pydantic.Field(alias="fontSize")] = None


class Field3TypedDict(TypedDict):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsType
    recipient_id: float
    r"""The ID of the recipient to create the field for."""
    page_number: float
    r"""The page number the field will be on."""
    page_x: float
    r"""The X coordinate of where the field will be placed."""
    page_y: float
    r"""The Y coordinate of where the field will be placed."""
    width: float
    r"""The width of the field."""
    height: float
    r"""The height of the field."""
    field_meta: NotRequired[FieldFieldMetaTypedDict]


class Field3(BaseModel):
    type: FieldCreateDocumentFieldFieldDocumentsFieldsType

    recipient_id: Annotated[float, pydantic.Field(alias="recipientId")]
    r"""The ID of the recipient to create the field for."""

    page_number: Annotated[float, pydantic.Field(alias="pageNumber")]
    r"""The page number the field will be on."""

    page_x: Annotated[float, pydantic.Field(alias="pageX")]
    r"""The X coordinate of where the field will be placed."""

    page_y: Annotated[float, pydantic.Field(alias="pageY")]
    r"""The Y coordinate of where the field will be placed."""

    width: float
    r"""The width of the field."""

    height: float
    r"""The height of the field."""

    field_meta: Annotated[
        Optional[FieldFieldMeta], pydantic.Field(alias="fieldMeta")
    ] = None


class FieldCreateDocumentFieldFieldType(str, Enum):
    FREE_SIGNATURE = "FREE_SIGNATURE"


class Field2TypedDict(TypedDict):
    type: FieldCreateDocumentFieldFieldType
    recipient_id: float
    r"""The ID of the recipient to create the field for."""
    page_number: float
    r"""The page number the field will be on."""
    page_x: float
    r"""The X coordinate of where the field will be placed."""
    page_y: float
    r"""The Y coordinate of where the field will be placed."""
    width: float
    r"""The width of the field."""
    height: float
    r"""The height of the field."""


class Field2(BaseModel):
    type: FieldCreateDocumentFieldFieldType

    recipient_id: Annotated[float, pydantic.Field(alias="recipientId")]
    r"""The ID of the recipient to create the field for."""

    page_number: Annotated[float, pydantic.Field(alias="pageNumber")]
    r"""The page number the field will be on."""

    page_x: Annotated[float, pydantic.Field(alias="pageX")]
    r"""The X coordinate of where the field will be placed."""

    page_y: Annotated[float, pydantic.Field(alias="pageY")]
    r"""The Y coordinate of where the field will be placed."""

    width: float
    r"""The width of the field."""

    height: float
    r"""The height of the field."""


class FieldType(str, Enum):
    SIGNATURE = "SIGNATURE"


class Field1TypedDict(TypedDict):
    type: FieldType
    recipient_id: float
    r"""The ID of the recipient to create the field for."""
    page_number: float
    r"""The page number the field will be on."""
    page_x: float
    r"""The X coordinate of where the field will be placed."""
    page_y: float
    r"""The Y coordinate of where the field will be placed."""
    width: float
    r"""The width of the field."""
    height: float
    r"""The height of the field."""


class Field1(BaseModel):
    type: FieldType

    recipient_id: Annotated[float, pydantic.Field(alias="recipientId")]
    r"""The ID of the recipient to create the field for."""

    page_number: Annotated[float, pydantic.Field(alias="pageNumber")]
    r"""The page number the field will be on."""

    page_x: Annotated[float, pydantic.Field(alias="pageX")]
    r"""The X coordinate of where the field will be placed."""

    page_y: Annotated[float, pydantic.Field(alias="pageY")]
    r"""The Y coordinate of where the field will be placed."""

    width: float
    r"""The width of the field."""

    height: float
    r"""The height of the field."""


FieldTTypedDict = TypeAliasType(
    "FieldTTypedDict",
    Union[
        Field1TypedDict,
        Field2TypedDict,
        Field3TypedDict,
        Field4TypedDict,
        Field5TypedDict,
        Field6TypedDict,
        Field7TypedDict,
        Field8TypedDict,
        Field9TypedDict,
        Field10TypedDict,
        Field11TypedDict,
    ],
)


FieldT = TypeAliasType(
    "FieldT",
    Union[
        Field1,
        Field2,
        Field3,
        Field4,
        Field5,
        Field6,
        Field7,
        Field8,
        Field9,
        Field10,
        Field11,
    ],
)


class FieldCreateDocumentFieldRequestBodyTypedDict(TypedDict):
    document_id: float
    field: FieldTTypedDict


class FieldCreateDocumentFieldRequestBody(BaseModel):
    document_id: Annotated[float, pydantic.Field(alias="documentId")]

    field: FieldT


class FieldCreateDocumentFieldDocumentsFieldsIssuesTypedDict(TypedDict):
    message: str


class FieldCreateDocumentFieldDocumentsFieldsIssues(BaseModel):
    message: str


class FieldCreateDocumentFieldDocumentsFieldsResponseResponseBodyData(BaseModel):
    message: str

    code: str

    issues: Optional[List[FieldCreateDocumentFieldDocumentsFieldsIssues]] = None


class FieldCreateDocumentFieldDocumentsFieldsResponseResponseBody(Exception):
    r"""Internal server error"""

    data: FieldCreateDocumentFieldDocumentsFieldsResponseResponseBodyData

    def __init__(
        self, data: FieldCreateDocumentFieldDocumentsFieldsResponseResponseBodyData
    ):
        self.data = data

    def __str__(self) -> str:
        return utils.marshal_json(
            self.data, FieldCreateDocumentFieldDocumentsFieldsResponseResponseBodyData
        )


class FieldCreateDocumentFieldIssuesTypedDict(TypedDict):
    message: str


class FieldCreateDocumentFieldIssues(BaseModel):
    message: str


class FieldCreateDocumentFieldDocumentsFieldsResponseBodyData(BaseModel):
    message: str

    code: str

    issues: Optional[List[FieldCreateDocumentFieldIssues]] = None


class FieldCreateDocumentFieldDocumentsFieldsResponseBody(Exception):
    r"""Invalid input data"""

    data: FieldCreateDocumentFieldDocumentsFieldsResponseBodyData

    def __init__(self, data: FieldCreateDocumentFieldDocumentsFieldsResponseBodyData):
        self.data = data

    def __str__(self) -> str:
        return utils.marshal_json(
            self.data, FieldCreateDocumentFieldDocumentsFieldsResponseBodyData
        )


class FieldCreateDocumentFieldType(str, Enum):
    SIGNATURE = "SIGNATURE"
    FREE_SIGNATURE = "FREE_SIGNATURE"
    INITIALS = "INITIALS"
    NAME = "NAME"
    EMAIL = "EMAIL"
    DATE = "DATE"
    TEXT = "TEXT"
    NUMBER = "NUMBER"
    RADIO = "RADIO"
    CHECKBOX = "CHECKBOX"
    DROPDOWN = "DROPDOWN"


class FieldCreateDocumentFieldFieldMetaDocumentsFieldsResponse200ApplicationJSONResponseBody9Type(
    str, Enum
):
    DROPDOWN = "dropdown"


class FieldCreateDocumentFieldFieldMetaDocumentsFieldsResponseValuesTypedDict(
    TypedDict
):
    value: str


class FieldCreateDocumentFieldFieldMetaDocumentsFieldsResponseValues(BaseModel):
    value: str


class FieldCreateDocumentFieldFieldMeta9TypedDict(TypedDict):
    type: FieldCreateDocumentFieldFieldMetaDocumentsFieldsResponse200ApplicationJSONResponseBody9Type
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    values: NotRequired[
        List[FieldCreateDocumentFieldFieldMetaDocumentsFieldsResponseValuesTypedDict]
    ]
    default_value: NotRequired[str]


class FieldCreateDocumentFieldFieldMeta9(BaseModel):
    type: FieldCreateDocumentFieldFieldMetaDocumentsFieldsResponse200ApplicationJSONResponseBody9Type

    label: Optional[str] = None

    placeholder: Optional[str] = None

    required: Optional[bool] = None

    read_only: Annotated[Optional[bool], pydantic.Field(alias="readOnly")] = None

    values: Optional[
        List[FieldCreateDocumentFieldFieldMetaDocumentsFieldsResponseValues]
    ] = None

    default_value: Annotated[Optional[str], pydantic.Field(alias="defaultValue")] = None


class FieldCreateDocumentFieldFieldMetaDocumentsFieldsResponse200ApplicationJSONResponseBody8Type(
    str, Enum
):
    CHECKBOX = "checkbox"


class FieldCreateDocumentFieldFieldMetaDocumentsFieldsValuesTypedDict(TypedDict):
    id: float
    checked: bool
    value: str


class FieldCreateDocumentFieldFieldMetaDocumentsFieldsValues(BaseModel):
    id: float

    checked: bool

    value: str


class FieldCreateDocumentFieldFieldMeta8TypedDict(TypedDict):
    type: FieldCreateDocumentFieldFieldMetaDocumentsFieldsResponse200ApplicationJSONResponseBody8Type
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    values: NotRequired[
        List[FieldCreateDocumentFieldFieldMetaDocumentsFieldsValuesTypedDict]
    ]
    validation_rule: NotRequired[str]
    validation_length: NotRequired[float]


class FieldCreateDocumentFieldFieldMeta8(BaseModel):
    type: FieldCreateDocumentFieldFieldMetaDocumentsFieldsResponse200ApplicationJSONResponseBody8Type

    label: Optional[str] = None

    placeholder: Optional[str] = None

    required: Optional[bool] = None

    read_only: Annotated[Optional[bool], pydantic.Field(alias="readOnly")] = None

    values: Optional[List[FieldCreateDocumentFieldFieldMetaDocumentsFieldsValues]] = (
        None
    )

    validation_rule: Annotated[
        Optional[str], pydantic.Field(alias="validationRule")
    ] = None

    validation_length: Annotated[
        Optional[float], pydantic.Field(alias="validationLength")
    ] = None


class FieldCreateDocumentFieldFieldMetaDocumentsFieldsResponse200ApplicationJSONResponseBody7Type(
    str, Enum
):
    RADIO = "radio"


class FieldCreateDocumentFieldFieldMetaValuesTypedDict(TypedDict):
    id: float
    checked: bool
    value: str


class FieldCreateDocumentFieldFieldMetaValues(BaseModel):
    id: float

    checked: bool

    value: str


class FieldCreateDocumentFieldFieldMeta7TypedDict(TypedDict):
    type: FieldCreateDocumentFieldFieldMetaDocumentsFieldsResponse200ApplicationJSONResponseBody7Type
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    values: NotRequired[List[FieldCreateDocumentFieldFieldMetaValuesTypedDict]]


class FieldCreateDocumentFieldFieldMeta7(BaseModel):
    type: FieldCreateDocumentFieldFieldMetaDocumentsFieldsResponse200ApplicationJSONResponseBody7Type

    label: Optional[str] = None

    placeholder: Optional[str] = None

    required: Optional[bool] = None

    read_only: Annotated[Optional[bool], pydantic.Field(alias="readOnly")] = None

    values: Optional[List[FieldCreateDocumentFieldFieldMetaValues]] = None


class FieldCreateDocumentFieldFieldMetaDocumentsFieldsResponse200ApplicationJSONResponseBodyType(
    str, Enum
):
    NUMBER = "number"


class FieldCreateDocumentFieldFieldMeta6TypedDict(TypedDict):
    type: FieldCreateDocumentFieldFieldMetaDocumentsFieldsResponse200ApplicationJSONResponseBodyType
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    number_format: NotRequired[str]
    value: NotRequired[str]
    min_value: NotRequired[float]
    max_value: NotRequired[float]
    font_size: NotRequired[float]


class FieldCreateDocumentFieldFieldMeta6(BaseModel):
    type: FieldCreateDocumentFieldFieldMetaDocumentsFieldsResponse200ApplicationJSONResponseBodyType

    label: Optional[str] = None

    placeholder: Optional[str] = None

    required: Optional[bool] = None

    read_only: Annotated[Optional[bool], pydantic.Field(alias="readOnly")] = None

    number_format: Annotated[Optional[str], pydantic.Field(alias="numberFormat")] = None

    value: Optional[str] = None

    min_value: Annotated[Optional[float], pydantic.Field(alias="minValue")] = None

    max_value: Annotated[Optional[float], pydantic.Field(alias="maxValue")] = None

    font_size: Annotated[Optional[float], pydantic.Field(alias="fontSize")] = None


class FieldCreateDocumentFieldFieldMetaDocumentsFieldsResponse200ApplicationJSONType(
    str, Enum
):
    TEXT = "text"


class FieldCreateDocumentFieldFieldMeta5TypedDict(TypedDict):
    type: FieldCreateDocumentFieldFieldMetaDocumentsFieldsResponse200ApplicationJSONType
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    text: NotRequired[str]
    character_limit: NotRequired[float]
    font_size: NotRequired[float]


class FieldCreateDocumentFieldFieldMeta5(BaseModel):
    type: FieldCreateDocumentFieldFieldMetaDocumentsFieldsResponse200ApplicationJSONType

    label: Optional[str] = None

    placeholder: Optional[str] = None

    required: Optional[bool] = None

    read_only: Annotated[Optional[bool], pydantic.Field(alias="readOnly")] = None

    text: Optional[str] = None

    character_limit: Annotated[
        Optional[float], pydantic.Field(alias="characterLimit")
    ] = None

    font_size: Annotated[Optional[float], pydantic.Field(alias="fontSize")] = None


class FieldCreateDocumentFieldFieldMetaDocumentsFieldsResponse200Type(str, Enum):
    DATE = "date"


class FieldCreateDocumentFieldFieldMeta4TypedDict(TypedDict):
    type: FieldCreateDocumentFieldFieldMetaDocumentsFieldsResponse200Type
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    font_size: NotRequired[float]


class FieldCreateDocumentFieldFieldMeta4(BaseModel):
    type: FieldCreateDocumentFieldFieldMetaDocumentsFieldsResponse200Type

    label: Optional[str] = None

    placeholder: Optional[str] = None

    required: Optional[bool] = None

    read_only: Annotated[Optional[bool], pydantic.Field(alias="readOnly")] = None

    font_size: Annotated[Optional[float], pydantic.Field(alias="fontSize")] = None


class FieldCreateDocumentFieldFieldMetaDocumentsFieldsResponseType(str, Enum):
    EMAIL = "email"


class FieldCreateDocumentFieldFieldMeta3TypedDict(TypedDict):
    type: FieldCreateDocumentFieldFieldMetaDocumentsFieldsResponseType
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    font_size: NotRequired[float]


class FieldCreateDocumentFieldFieldMeta3(BaseModel):
    type: FieldCreateDocumentFieldFieldMetaDocumentsFieldsResponseType

    label: Optional[str] = None

    placeholder: Optional[str] = None

    required: Optional[bool] = None

    read_only: Annotated[Optional[bool], pydantic.Field(alias="readOnly")] = None

    font_size: Annotated[Optional[float], pydantic.Field(alias="fontSize")] = None


class FieldCreateDocumentFieldFieldMetaDocumentsFieldsType(str, Enum):
    NAME = "name"


class FieldCreateDocumentFieldFieldMeta2TypedDict(TypedDict):
    type: FieldCreateDocumentFieldFieldMetaDocumentsFieldsType
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    font_size: NotRequired[float]


class FieldCreateDocumentFieldFieldMeta2(BaseModel):
    type: FieldCreateDocumentFieldFieldMetaDocumentsFieldsType

    label: Optional[str] = None

    placeholder: Optional[str] = None

    required: Optional[bool] = None

    read_only: Annotated[Optional[bool], pydantic.Field(alias="readOnly")] = None

    font_size: Annotated[Optional[float], pydantic.Field(alias="fontSize")] = None


class FieldCreateDocumentFieldFieldMetaType(str, Enum):
    INITIALS = "initials"


class FieldCreateDocumentFieldFieldMeta1TypedDict(TypedDict):
    type: FieldCreateDocumentFieldFieldMetaType
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    font_size: NotRequired[float]


class FieldCreateDocumentFieldFieldMeta1(BaseModel):
    type: FieldCreateDocumentFieldFieldMetaType

    label: Optional[str] = None

    placeholder: Optional[str] = None

    required: Optional[bool] = None

    read_only: Annotated[Optional[bool], pydantic.Field(alias="readOnly")] = None

    font_size: Annotated[Optional[float], pydantic.Field(alias="fontSize")] = None


FieldCreateDocumentFieldFieldMetaTypedDict = TypeAliasType(
    "FieldCreateDocumentFieldFieldMetaTypedDict",
    Union[
        FieldCreateDocumentFieldFieldMeta1TypedDict,
        FieldCreateDocumentFieldFieldMeta2TypedDict,
        FieldCreateDocumentFieldFieldMeta3TypedDict,
        FieldCreateDocumentFieldFieldMeta4TypedDict,
        FieldCreateDocumentFieldFieldMeta7TypedDict,
        FieldCreateDocumentFieldFieldMeta9TypedDict,
        FieldCreateDocumentFieldFieldMeta5TypedDict,
        FieldCreateDocumentFieldFieldMeta8TypedDict,
        FieldCreateDocumentFieldFieldMeta6TypedDict,
    ],
)


FieldCreateDocumentFieldFieldMeta = TypeAliasType(
    "FieldCreateDocumentFieldFieldMeta",
    Union[
        FieldCreateDocumentFieldFieldMeta1,
        FieldCreateDocumentFieldFieldMeta2,
        FieldCreateDocumentFieldFieldMeta3,
        FieldCreateDocumentFieldFieldMeta4,
        FieldCreateDocumentFieldFieldMeta7,
        FieldCreateDocumentFieldFieldMeta9,
        FieldCreateDocumentFieldFieldMeta5,
        FieldCreateDocumentFieldFieldMeta8,
        FieldCreateDocumentFieldFieldMeta6,
    ],
)


class FieldCreateDocumentFieldResponseBodyTypedDict(TypedDict):
    r"""Successful response"""

    type: FieldCreateDocumentFieldType
    id: int
    secondary_id: str
    document_id: Nullable[int]
    template_id: Nullable[int]
    recipient_id: int
    page: float
    r"""The page number of the field on the document. Starts from 1."""
    custom_text: str
    inserted: bool
    field_meta: Nullable[FieldCreateDocumentFieldFieldMetaTypedDict]
    position_x: NotRequired[Any]
    position_y: NotRequired[Any]
    width: NotRequired[Any]
    height: NotRequired[Any]


class FieldCreateDocumentFieldResponseBody(BaseModel):
    r"""Successful response"""

    type: FieldCreateDocumentFieldType

    id: int

    secondary_id: Annotated[str, pydantic.Field(alias="secondaryId")]

    document_id: Annotated[Nullable[int], pydantic.Field(alias="documentId")]

    template_id: Annotated[Nullable[int], pydantic.Field(alias="templateId")]

    recipient_id: Annotated[int, pydantic.Field(alias="recipientId")]

    page: float
    r"""The page number of the field on the document. Starts from 1."""

    custom_text: Annotated[str, pydantic.Field(alias="customText")]

    inserted: bool

    field_meta: Annotated[
        Nullable[FieldCreateDocumentFieldFieldMeta], pydantic.Field(alias="fieldMeta")
    ]

    position_x: Annotated[Optional[Any], pydantic.Field(alias="positionX")] = None

    position_y: Annotated[Optional[Any], pydantic.Field(alias="positionY")] = None

    width: Optional[Any] = None

    height: Optional[Any] = None

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = ["positionX", "positionY", "width", "height"]
        nullable_fields = ["documentId", "templateId", "fieldMeta"]
        null_default_fields = []

        serialized = handler(self)

        m = {}

        for n, f in self.model_fields.items():
            k = f.alias or n
            val = serialized.get(k)
            serialized.pop(k, None)

            optional_nullable = k in optional_fields and k in nullable_fields
            is_set = (
                self.__pydantic_fields_set__.intersection({n})
                or k in null_default_fields
            )  # pylint: disable=no-member

            if val is not None and val != UNSET_SENTINEL:
                m[k] = val
            elif val != UNSET_SENTINEL and (
                not k in optional_fields or (optional_nullable and is_set)
            ):
                m[k] = val

        return m
