"""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 FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody11Type(str, Enum):
    DROPDOWN = "DROPDOWN"


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


class FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestValuesTypedDict(TypedDict):
    value: str


class FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestValues(BaseModel):
    value: str


class FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody11FieldMetaTypedDict(
    TypedDict
):
    type: (
        FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody11FieldMetaType
    )
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    values: NotRequired[
        List[FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestValuesTypedDict]
    ]
    default_value: NotRequired[str]


class FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody11FieldMeta(
    BaseModel
):
    type: (
        FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody11FieldMetaType
    )

    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[FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestValues]
    ] = None

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


class Fields11TypedDict(TypedDict):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody11Type
    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[
        FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody11FieldMetaTypedDict
    ]


class Fields11(BaseModel):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody11Type

    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[
            FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody11FieldMeta
        ],
        pydantic.Field(alias="fieldMeta"),
    ] = None


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


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


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


class FieldCreateDocumentFieldsFieldsDocumentsFieldsValues(BaseModel):
    id: float

    checked: bool

    value: str


class FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody10FieldMetaTypedDict(
    TypedDict
):
    type: (
        FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody10FieldMetaType
    )
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    values: NotRequired[
        List[FieldCreateDocumentFieldsFieldsDocumentsFieldsValuesTypedDict]
    ]
    validation_rule: NotRequired[str]
    validation_length: NotRequired[float]


class FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody10FieldMeta(
    BaseModel
):
    type: (
        FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody10FieldMetaType
    )

    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[FieldCreateDocumentFieldsFieldsDocumentsFieldsValues]] = None

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

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


class Fields10TypedDict(TypedDict):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody10Type
    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[
        FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody10FieldMetaTypedDict
    ]


class Fields10(BaseModel):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody10Type

    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[
            FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody10FieldMeta
        ],
        pydantic.Field(alias="fieldMeta"),
    ] = None


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


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


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


class FieldCreateDocumentFieldsFieldsValues(BaseModel):
    id: float

    checked: bool

    value: str


class FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody9FieldMetaTypedDict(
    TypedDict
):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody9FieldMetaType
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    values: NotRequired[List[FieldCreateDocumentFieldsFieldsValuesTypedDict]]


class FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody9FieldMeta(
    BaseModel
):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody9FieldMetaType

    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[FieldCreateDocumentFieldsFieldsValues]] = None


class Fields9TypedDict(TypedDict):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody9Type
    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[
        FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody9FieldMetaTypedDict
    ]


class Fields9(BaseModel):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody9Type

    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[
            FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody9FieldMeta
        ],
        pydantic.Field(alias="fieldMeta"),
    ] = None


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


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


class FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody8FieldMetaTypedDict(
    TypedDict
):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody8FieldMetaType
    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 FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody8FieldMeta(
    BaseModel
):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody8FieldMetaType

    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 Fields8TypedDict(TypedDict):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody8Type
    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[
        FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody8FieldMetaTypedDict
    ]


class Fields8(BaseModel):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody8Type

    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[
            FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody8FieldMeta
        ],
        pydantic.Field(alias="fieldMeta"),
    ] = None


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


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


class FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody7FieldMetaTypedDict(
    TypedDict
):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody7FieldMetaType
    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 FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody7FieldMeta(
    BaseModel
):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody7FieldMetaType

    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 Fields7TypedDict(TypedDict):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody7Type
    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[
        FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody7FieldMetaTypedDict
    ]


class Fields7(BaseModel):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody7Type

    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[
            FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody7FieldMeta
        ],
        pydantic.Field(alias="fieldMeta"),
    ] = None


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


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


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


class FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBodyFieldMeta(
    BaseModel
):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody6FieldMetaType

    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 Fields6TypedDict(TypedDict):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody6Type
    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[
        FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBodyFieldMetaTypedDict
    ]


class Fields6(BaseModel):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody6Type

    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[
            FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBodyFieldMeta
        ],
        pydantic.Field(alias="fieldMeta"),
    ] = None


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


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


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


class FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestFieldMeta(BaseModel):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody5FieldMetaType

    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 Fields5TypedDict(TypedDict):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody5Type
    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[
        FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestFieldMetaTypedDict
    ]


class Fields5(BaseModel):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody5Type

    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[FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestFieldMeta],
        pydantic.Field(alias="fieldMeta"),
    ] = None


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


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


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


class FieldCreateDocumentFieldsFieldsDocumentsFieldsFieldMeta(BaseModel):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody4FieldMetaType

    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 Fields4TypedDict(TypedDict):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody4Type
    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[
        FieldCreateDocumentFieldsFieldsDocumentsFieldsFieldMetaTypedDict
    ]


class Fields4(BaseModel):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBody4Type

    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[FieldCreateDocumentFieldsFieldsDocumentsFieldsFieldMeta],
        pydantic.Field(alias="fieldMeta"),
    ] = None


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


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


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


class FieldCreateDocumentFieldsFieldsFieldMeta(BaseModel):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestRequestBodyType

    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 Fields3TypedDict(TypedDict):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestType
    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[FieldCreateDocumentFieldsFieldsFieldMetaTypedDict]


class Fields3(BaseModel):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsRequestType

    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[FieldCreateDocumentFieldsFieldsFieldMeta],
        pydantic.Field(alias="fieldMeta"),
    ] = None


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


class Fields2TypedDict(TypedDict):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsType
    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 Fields2(BaseModel):
    type: FieldCreateDocumentFieldsFieldsDocumentsFieldsType

    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 FieldCreateDocumentFieldsFieldsType(str, Enum):
    SIGNATURE = "SIGNATURE"


class Fields1TypedDict(TypedDict):
    type: FieldCreateDocumentFieldsFieldsType
    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 Fields1(BaseModel):
    type: FieldCreateDocumentFieldsFieldsType

    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."""


FieldCreateDocumentFieldsFieldsTypedDict = TypeAliasType(
    "FieldCreateDocumentFieldsFieldsTypedDict",
    Union[
        Fields1TypedDict,
        Fields2TypedDict,
        Fields3TypedDict,
        Fields4TypedDict,
        Fields5TypedDict,
        Fields6TypedDict,
        Fields7TypedDict,
        Fields8TypedDict,
        Fields9TypedDict,
        Fields10TypedDict,
        Fields11TypedDict,
    ],
)


FieldCreateDocumentFieldsFields = TypeAliasType(
    "FieldCreateDocumentFieldsFields",
    Union[
        Fields1,
        Fields2,
        Fields3,
        Fields4,
        Fields5,
        Fields6,
        Fields7,
        Fields8,
        Fields9,
        Fields10,
        Fields11,
    ],
)


class FieldCreateDocumentFieldsRequestBodyTypedDict(TypedDict):
    document_id: float
    fields: List[FieldCreateDocumentFieldsFieldsTypedDict]


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

    fields: List[FieldCreateDocumentFieldsFields]


class FieldCreateDocumentFieldsDocumentsFieldsIssuesTypedDict(TypedDict):
    message: str


class FieldCreateDocumentFieldsDocumentsFieldsIssues(BaseModel):
    message: str


class FieldCreateDocumentFieldsDocumentsFieldsResponseResponseBodyData(BaseModel):
    message: str

    code: str

    issues: Optional[List[FieldCreateDocumentFieldsDocumentsFieldsIssues]] = None


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

    data: FieldCreateDocumentFieldsDocumentsFieldsResponseResponseBodyData

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

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


class FieldCreateDocumentFieldsIssuesTypedDict(TypedDict):
    message: str


class FieldCreateDocumentFieldsIssues(BaseModel):
    message: str


class FieldCreateDocumentFieldsDocumentsFieldsResponseBodyData(BaseModel):
    message: str

    code: str

    issues: Optional[List[FieldCreateDocumentFieldsIssues]] = None


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

    data: FieldCreateDocumentFieldsDocumentsFieldsResponseBodyData

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

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


class FieldCreateDocumentFieldsType(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 FieldCreateDocumentFieldsFieldMetaDocumentsFieldsResponse200ApplicationJSONResponseBodyFields9Type(
    str, Enum
):
    DROPDOWN = "dropdown"


class FieldCreateDocumentFieldsFieldMetaDocumentsFieldsResponseValuesTypedDict(
    TypedDict
):
    value: str


class FieldCreateDocumentFieldsFieldMetaDocumentsFieldsResponseValues(BaseModel):
    value: str


class FieldCreateDocumentFieldsFieldMeta9TypedDict(TypedDict):
    type: FieldCreateDocumentFieldsFieldMetaDocumentsFieldsResponse200ApplicationJSONResponseBodyFields9Type
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    values: NotRequired[
        List[FieldCreateDocumentFieldsFieldMetaDocumentsFieldsResponseValuesTypedDict]
    ]
    default_value: NotRequired[str]


class FieldCreateDocumentFieldsFieldMeta9(BaseModel):
    type: FieldCreateDocumentFieldsFieldMetaDocumentsFieldsResponse200ApplicationJSONResponseBodyFields9Type

    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[FieldCreateDocumentFieldsFieldMetaDocumentsFieldsResponseValues]
    ] = None

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


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


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


class FieldCreateDocumentFieldsFieldMetaDocumentsFieldsValues(BaseModel):
    id: float

    checked: bool

    value: str


class FieldCreateDocumentFieldsFieldMeta8TypedDict(TypedDict):
    type: FieldCreateDocumentFieldsFieldMetaDocumentsFieldsResponse200ApplicationJSONResponseBodyFields8Type
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    values: NotRequired[
        List[FieldCreateDocumentFieldsFieldMetaDocumentsFieldsValuesTypedDict]
    ]
    validation_rule: NotRequired[str]
    validation_length: NotRequired[float]


class FieldCreateDocumentFieldsFieldMeta8(BaseModel):
    type: FieldCreateDocumentFieldsFieldMetaDocumentsFieldsResponse200ApplicationJSONResponseBodyFields8Type

    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[FieldCreateDocumentFieldsFieldMetaDocumentsFieldsValues]] = (
        None
    )

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

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


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


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


class FieldCreateDocumentFieldsFieldMetaValues(BaseModel):
    id: float

    checked: bool

    value: str


class FieldCreateDocumentFieldsFieldMeta7TypedDict(TypedDict):
    type: FieldCreateDocumentFieldsFieldMetaDocumentsFieldsResponse200ApplicationJSONResponseBodyFieldsType
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    values: NotRequired[List[FieldCreateDocumentFieldsFieldMetaValuesTypedDict]]


class FieldCreateDocumentFieldsFieldMeta7(BaseModel):
    type: FieldCreateDocumentFieldsFieldMetaDocumentsFieldsResponse200ApplicationJSONResponseBodyFieldsType

    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[FieldCreateDocumentFieldsFieldMetaValues]] = None


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


class FieldCreateDocumentFieldsFieldMeta6TypedDict(TypedDict):
    type: FieldCreateDocumentFieldsFieldMetaDocumentsFieldsResponse200ApplicationJSONResponseBodyType
    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 FieldCreateDocumentFieldsFieldMeta6(BaseModel):
    type: FieldCreateDocumentFieldsFieldMetaDocumentsFieldsResponse200ApplicationJSONResponseBodyType

    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 FieldCreateDocumentFieldsFieldMetaDocumentsFieldsResponse200ApplicationJSONType(
    str, Enum
):
    TEXT = "text"


class FieldCreateDocumentFieldsFieldMeta5TypedDict(TypedDict):
    type: (
        FieldCreateDocumentFieldsFieldMetaDocumentsFieldsResponse200ApplicationJSONType
    )
    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 FieldCreateDocumentFieldsFieldMeta5(BaseModel):
    type: (
        FieldCreateDocumentFieldsFieldMetaDocumentsFieldsResponse200ApplicationJSONType
    )

    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 FieldCreateDocumentFieldsFieldMetaDocumentsFieldsResponse200Type(str, Enum):
    DATE = "date"


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


class FieldCreateDocumentFieldsFieldMeta4(BaseModel):
    type: FieldCreateDocumentFieldsFieldMetaDocumentsFieldsResponse200Type

    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 FieldCreateDocumentFieldsFieldMetaDocumentsFieldsResponseType(str, Enum):
    EMAIL = "email"


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


class FieldCreateDocumentFieldsFieldMeta3(BaseModel):
    type: FieldCreateDocumentFieldsFieldMetaDocumentsFieldsResponseType

    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 FieldCreateDocumentFieldsFieldMetaDocumentsFieldsType(str, Enum):
    NAME = "name"


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


class FieldCreateDocumentFieldsFieldMeta2(BaseModel):
    type: FieldCreateDocumentFieldsFieldMetaDocumentsFieldsType

    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 FieldCreateDocumentFieldsFieldMetaType(str, Enum):
    INITIALS = "initials"


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


class FieldCreateDocumentFieldsFieldMeta1(BaseModel):
    type: FieldCreateDocumentFieldsFieldMetaType

    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


FieldCreateDocumentFieldsFieldMetaTypedDict = TypeAliasType(
    "FieldCreateDocumentFieldsFieldMetaTypedDict",
    Union[
        FieldCreateDocumentFieldsFieldMeta1TypedDict,
        FieldCreateDocumentFieldsFieldMeta2TypedDict,
        FieldCreateDocumentFieldsFieldMeta3TypedDict,
        FieldCreateDocumentFieldsFieldMeta4TypedDict,
        FieldCreateDocumentFieldsFieldMeta7TypedDict,
        FieldCreateDocumentFieldsFieldMeta9TypedDict,
        FieldCreateDocumentFieldsFieldMeta5TypedDict,
        FieldCreateDocumentFieldsFieldMeta8TypedDict,
        FieldCreateDocumentFieldsFieldMeta6TypedDict,
    ],
)


FieldCreateDocumentFieldsFieldMeta = TypeAliasType(
    "FieldCreateDocumentFieldsFieldMeta",
    Union[
        FieldCreateDocumentFieldsFieldMeta1,
        FieldCreateDocumentFieldsFieldMeta2,
        FieldCreateDocumentFieldsFieldMeta3,
        FieldCreateDocumentFieldsFieldMeta4,
        FieldCreateDocumentFieldsFieldMeta7,
        FieldCreateDocumentFieldsFieldMeta9,
        FieldCreateDocumentFieldsFieldMeta5,
        FieldCreateDocumentFieldsFieldMeta8,
        FieldCreateDocumentFieldsFieldMeta6,
    ],
)


class FieldCreateDocumentFieldsDocumentsFieldsFieldsTypedDict(TypedDict):
    type: FieldCreateDocumentFieldsType
    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[FieldCreateDocumentFieldsFieldMetaTypedDict]
    position_x: NotRequired[Any]
    position_y: NotRequired[Any]
    width: NotRequired[Any]
    height: NotRequired[Any]


class FieldCreateDocumentFieldsDocumentsFieldsFields(BaseModel):
    type: FieldCreateDocumentFieldsType

    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[FieldCreateDocumentFieldsFieldMeta], 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


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

    fields: List[FieldCreateDocumentFieldsDocumentsFieldsFieldsTypedDict]


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

    fields: List[FieldCreateDocumentFieldsDocumentsFieldsFields]
