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


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


class FieldCreateTemplateFieldFieldTemplatesFieldsRequestValuesTypedDict(TypedDict):
    value: str


class FieldCreateTemplateFieldFieldTemplatesFieldsRequestValues(BaseModel):
    value: str


class FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody11FieldMetaTypedDict(
    TypedDict
):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody11FieldMetaType
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    values: NotRequired[
        List[FieldCreateTemplateFieldFieldTemplatesFieldsRequestValuesTypedDict]
    ]
    default_value: NotRequired[str]


class FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody11FieldMeta(
    BaseModel
):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody11FieldMetaType

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

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


class FieldCreateTemplateFieldField11TypedDict(TypedDict):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody11Type
    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[
        FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody11FieldMetaTypedDict
    ]


class FieldCreateTemplateFieldField11(BaseModel):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody11Type

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


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


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


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


class FieldCreateTemplateFieldFieldTemplatesFieldsValues(BaseModel):
    id: float

    checked: bool

    value: str


class FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody10FieldMetaTypedDict(
    TypedDict
):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody10FieldMetaType
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    values: NotRequired[
        List[FieldCreateTemplateFieldFieldTemplatesFieldsValuesTypedDict]
    ]
    validation_rule: NotRequired[str]
    validation_length: NotRequired[float]


class FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody10FieldMeta(
    BaseModel
):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody10FieldMetaType

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

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

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


class FieldCreateTemplateFieldField10TypedDict(TypedDict):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody10Type
    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[
        FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody10FieldMetaTypedDict
    ]


class FieldCreateTemplateFieldField10(BaseModel):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody10Type

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


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


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


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


class FieldCreateTemplateFieldFieldValues(BaseModel):
    id: float

    checked: bool

    value: str


class FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody9FieldMetaTypedDict(
    TypedDict
):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody9FieldMetaType
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    values: NotRequired[List[FieldCreateTemplateFieldFieldValuesTypedDict]]


class FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody9FieldMeta(
    BaseModel
):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody9FieldMetaType

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


class FieldCreateTemplateFieldField9TypedDict(TypedDict):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody9Type
    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[
        FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody9FieldMetaTypedDict
    ]


class FieldCreateTemplateFieldField9(BaseModel):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody9Type

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


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


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


class FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody8FieldMetaTypedDict(
    TypedDict
):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody8FieldMetaType
    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 FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody8FieldMeta(
    BaseModel
):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody8FieldMetaType

    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 FieldCreateTemplateFieldField8TypedDict(TypedDict):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody8Type
    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[
        FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody8FieldMetaTypedDict
    ]


class FieldCreateTemplateFieldField8(BaseModel):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody8Type

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


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


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


class FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody7FieldMetaTypedDict(
    TypedDict
):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody7FieldMetaType
    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 FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody7FieldMeta(
    BaseModel
):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody7FieldMetaType

    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 FieldCreateTemplateFieldField7TypedDict(TypedDict):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody7Type
    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[
        FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody7FieldMetaTypedDict
    ]


class FieldCreateTemplateFieldField7(BaseModel):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody7Type

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


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


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


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


class FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBodyFieldMeta(
    BaseModel
):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody6FieldMetaType

    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 FieldCreateTemplateFieldField6TypedDict(TypedDict):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody6Type
    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[
        FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBodyFieldMetaTypedDict
    ]


class FieldCreateTemplateFieldField6(BaseModel):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody6Type

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


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


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


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


class FieldCreateTemplateFieldFieldTemplatesFieldsRequestFieldMeta(BaseModel):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody5FieldMetaType

    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 FieldCreateTemplateFieldField5TypedDict(TypedDict):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody5Type
    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[
        FieldCreateTemplateFieldFieldTemplatesFieldsRequestFieldMetaTypedDict
    ]


class FieldCreateTemplateFieldField5(BaseModel):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody5Type

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


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


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


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


class FieldCreateTemplateFieldFieldTemplatesFieldsFieldMeta(BaseModel):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody4FieldMetaType

    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 FieldCreateTemplateFieldField4TypedDict(TypedDict):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody4Type
    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[
        FieldCreateTemplateFieldFieldTemplatesFieldsFieldMetaTypedDict
    ]


class FieldCreateTemplateFieldField4(BaseModel):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody4Type

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


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


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


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


class FieldCreateTemplateFieldFieldFieldMeta(BaseModel):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBodyType

    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 FieldCreateTemplateFieldField3TypedDict(TypedDict):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestType
    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[FieldCreateTemplateFieldFieldFieldMetaTypedDict]


class FieldCreateTemplateFieldField3(BaseModel):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsRequestType

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


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


class FieldCreateTemplateFieldField2TypedDict(TypedDict):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsType
    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 FieldCreateTemplateFieldField2(BaseModel):
    type: FieldCreateTemplateFieldFieldTemplatesFieldsType

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


class FieldCreateTemplateFieldField1TypedDict(TypedDict):
    type: FieldCreateTemplateFieldFieldType
    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 FieldCreateTemplateFieldField1(BaseModel):
    type: FieldCreateTemplateFieldFieldType

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


FieldCreateTemplateFieldFieldTypedDict = TypeAliasType(
    "FieldCreateTemplateFieldFieldTypedDict",
    Union[
        FieldCreateTemplateFieldField1TypedDict,
        FieldCreateTemplateFieldField2TypedDict,
        FieldCreateTemplateFieldField3TypedDict,
        FieldCreateTemplateFieldField4TypedDict,
        FieldCreateTemplateFieldField5TypedDict,
        FieldCreateTemplateFieldField6TypedDict,
        FieldCreateTemplateFieldField7TypedDict,
        FieldCreateTemplateFieldField8TypedDict,
        FieldCreateTemplateFieldField9TypedDict,
        FieldCreateTemplateFieldField10TypedDict,
        FieldCreateTemplateFieldField11TypedDict,
    ],
)


FieldCreateTemplateFieldField = TypeAliasType(
    "FieldCreateTemplateFieldField",
    Union[
        FieldCreateTemplateFieldField1,
        FieldCreateTemplateFieldField2,
        FieldCreateTemplateFieldField3,
        FieldCreateTemplateFieldField4,
        FieldCreateTemplateFieldField5,
        FieldCreateTemplateFieldField6,
        FieldCreateTemplateFieldField7,
        FieldCreateTemplateFieldField8,
        FieldCreateTemplateFieldField9,
        FieldCreateTemplateFieldField10,
        FieldCreateTemplateFieldField11,
    ],
)


class FieldCreateTemplateFieldRequestBodyTypedDict(TypedDict):
    template_id: float
    field: FieldCreateTemplateFieldFieldTypedDict


class FieldCreateTemplateFieldRequestBody(BaseModel):
    template_id: Annotated[float, pydantic.Field(alias="templateId")]

    field: FieldCreateTemplateFieldField


class FieldCreateTemplateFieldTemplatesFieldsIssuesTypedDict(TypedDict):
    message: str


class FieldCreateTemplateFieldTemplatesFieldsIssues(BaseModel):
    message: str


class FieldCreateTemplateFieldTemplatesFieldsResponseResponseBodyData(BaseModel):
    message: str

    code: str

    issues: Optional[List[FieldCreateTemplateFieldTemplatesFieldsIssues]] = None


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

    data: FieldCreateTemplateFieldTemplatesFieldsResponseResponseBodyData

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

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


class FieldCreateTemplateFieldIssuesTypedDict(TypedDict):
    message: str


class FieldCreateTemplateFieldIssues(BaseModel):
    message: str


class FieldCreateTemplateFieldTemplatesFieldsResponseBodyData(BaseModel):
    message: str

    code: str

    issues: Optional[List[FieldCreateTemplateFieldIssues]] = None


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

    data: FieldCreateTemplateFieldTemplatesFieldsResponseBodyData

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

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


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


class FieldCreateTemplateFieldFieldMetaTemplatesFieldsResponseValuesTypedDict(
    TypedDict
):
    value: str


class FieldCreateTemplateFieldFieldMetaTemplatesFieldsResponseValues(BaseModel):
    value: str


class FieldCreateTemplateFieldFieldMeta9TypedDict(TypedDict):
    type: FieldCreateTemplateFieldFieldMetaTemplatesFieldsResponse200ApplicationJSONResponseBody9Type
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    values: NotRequired[
        List[FieldCreateTemplateFieldFieldMetaTemplatesFieldsResponseValuesTypedDict]
    ]
    default_value: NotRequired[str]


class FieldCreateTemplateFieldFieldMeta9(BaseModel):
    type: FieldCreateTemplateFieldFieldMetaTemplatesFieldsResponse200ApplicationJSONResponseBody9Type

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

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


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


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


class FieldCreateTemplateFieldFieldMetaTemplatesFieldsValues(BaseModel):
    id: float

    checked: bool

    value: str


class FieldCreateTemplateFieldFieldMeta8TypedDict(TypedDict):
    type: FieldCreateTemplateFieldFieldMetaTemplatesFieldsResponse200ApplicationJSONResponseBody8Type
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    values: NotRequired[
        List[FieldCreateTemplateFieldFieldMetaTemplatesFieldsValuesTypedDict]
    ]
    validation_rule: NotRequired[str]
    validation_length: NotRequired[float]


class FieldCreateTemplateFieldFieldMeta8(BaseModel):
    type: FieldCreateTemplateFieldFieldMetaTemplatesFieldsResponse200ApplicationJSONResponseBody8Type

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

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

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


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


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


class FieldCreateTemplateFieldFieldMetaValues(BaseModel):
    id: float

    checked: bool

    value: str


class FieldCreateTemplateFieldFieldMeta7TypedDict(TypedDict):
    type: FieldCreateTemplateFieldFieldMetaTemplatesFieldsResponse200ApplicationJSONResponseBody7Type
    label: NotRequired[str]
    placeholder: NotRequired[str]
    required: NotRequired[bool]
    read_only: NotRequired[bool]
    values: NotRequired[List[FieldCreateTemplateFieldFieldMetaValuesTypedDict]]


class FieldCreateTemplateFieldFieldMeta7(BaseModel):
    type: FieldCreateTemplateFieldFieldMetaTemplatesFieldsResponse200ApplicationJSONResponseBody7Type

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


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


class FieldCreateTemplateFieldFieldMeta6TypedDict(TypedDict):
    type: FieldCreateTemplateFieldFieldMetaTemplatesFieldsResponse200ApplicationJSONResponseBodyType
    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 FieldCreateTemplateFieldFieldMeta6(BaseModel):
    type: FieldCreateTemplateFieldFieldMetaTemplatesFieldsResponse200ApplicationJSONResponseBodyType

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


class FieldCreateTemplateFieldFieldMeta5TypedDict(TypedDict):
    type: FieldCreateTemplateFieldFieldMetaTemplatesFieldsResponse200ApplicationJSONType
    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 FieldCreateTemplateFieldFieldMeta5(BaseModel):
    type: FieldCreateTemplateFieldFieldMetaTemplatesFieldsResponse200ApplicationJSONType

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


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


class FieldCreateTemplateFieldFieldMeta4(BaseModel):
    type: FieldCreateTemplateFieldFieldMetaTemplatesFieldsResponse200Type

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


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


class FieldCreateTemplateFieldFieldMeta3(BaseModel):
    type: FieldCreateTemplateFieldFieldMetaTemplatesFieldsResponseType

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


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


class FieldCreateTemplateFieldFieldMeta2(BaseModel):
    type: FieldCreateTemplateFieldFieldMetaTemplatesFieldsType

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


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


class FieldCreateTemplateFieldFieldMeta1(BaseModel):
    type: FieldCreateTemplateFieldFieldMetaType

    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


FieldCreateTemplateFieldFieldMetaTypedDict = TypeAliasType(
    "FieldCreateTemplateFieldFieldMetaTypedDict",
    Union[
        FieldCreateTemplateFieldFieldMeta1TypedDict,
        FieldCreateTemplateFieldFieldMeta2TypedDict,
        FieldCreateTemplateFieldFieldMeta3TypedDict,
        FieldCreateTemplateFieldFieldMeta4TypedDict,
        FieldCreateTemplateFieldFieldMeta7TypedDict,
        FieldCreateTemplateFieldFieldMeta9TypedDict,
        FieldCreateTemplateFieldFieldMeta5TypedDict,
        FieldCreateTemplateFieldFieldMeta8TypedDict,
        FieldCreateTemplateFieldFieldMeta6TypedDict,
    ],
)


FieldCreateTemplateFieldFieldMeta = TypeAliasType(
    "FieldCreateTemplateFieldFieldMeta",
    Union[
        FieldCreateTemplateFieldFieldMeta1,
        FieldCreateTemplateFieldFieldMeta2,
        FieldCreateTemplateFieldFieldMeta3,
        FieldCreateTemplateFieldFieldMeta4,
        FieldCreateTemplateFieldFieldMeta7,
        FieldCreateTemplateFieldFieldMeta9,
        FieldCreateTemplateFieldFieldMeta5,
        FieldCreateTemplateFieldFieldMeta8,
        FieldCreateTemplateFieldFieldMeta6,
    ],
)


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

    type: FieldCreateTemplateFieldType
    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[FieldCreateTemplateFieldFieldMetaTypedDict]
    position_x: NotRequired[Any]
    position_y: NotRequired[Any]
    width: NotRequired[Any]
    height: NotRequired[Any]


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

    type: FieldCreateTemplateFieldType

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