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

from __future__ import annotations
from dataclasses import dataclass, field
from documenso_sdk.models import DocumensoError
from documenso_sdk.types import BaseModel
import httpx
import pydantic
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class EnvelopeItemUpdateManyDataRequestTypedDict(TypedDict):
    envelope_item_id: str
    order: NotRequired[int]
    title: NotRequired[str]


class EnvelopeItemUpdateManyDataRequest(BaseModel):
    envelope_item_id: Annotated[str, pydantic.Field(alias="envelopeItemId")]

    order: Optional[int] = None

    title: Optional[str] = None


class EnvelopeItemUpdateManyRequestTypedDict(TypedDict):
    envelope_id: str
    data: List[EnvelopeItemUpdateManyDataRequestTypedDict]


class EnvelopeItemUpdateManyRequest(BaseModel):
    envelope_id: Annotated[str, pydantic.Field(alias="envelopeId")]

    data: List[EnvelopeItemUpdateManyDataRequest]


class EnvelopeItemUpdateManyInternalServerErrorIssueTypedDict(TypedDict):
    message: str


class EnvelopeItemUpdateManyInternalServerErrorIssue(BaseModel):
    message: str


class EnvelopeItemUpdateManyInternalServerErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[EnvelopeItemUpdateManyInternalServerErrorIssue]] = None


@dataclass(unsafe_hash=True)
class EnvelopeItemUpdateManyInternalServerError(DocumensoError):
    r"""Internal server error"""

    data: EnvelopeItemUpdateManyInternalServerErrorData = field(hash=False)

    def __init__(
        self,
        data: EnvelopeItemUpdateManyInternalServerErrorData,
        raw_response: httpx.Response,
        body: Optional[str] = None,
    ):
        fallback = body or raw_response.text
        message = str(data.message) or fallback
        super().__init__(message, raw_response, body)
        object.__setattr__(self, "data", data)


class EnvelopeItemUpdateManyForbiddenIssueTypedDict(TypedDict):
    message: str


class EnvelopeItemUpdateManyForbiddenIssue(BaseModel):
    message: str


class EnvelopeItemUpdateManyForbiddenErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[EnvelopeItemUpdateManyForbiddenIssue]] = None


@dataclass(unsafe_hash=True)
class EnvelopeItemUpdateManyForbiddenError(DocumensoError):
    r"""Insufficient access"""

    data: EnvelopeItemUpdateManyForbiddenErrorData = field(hash=False)

    def __init__(
        self,
        data: EnvelopeItemUpdateManyForbiddenErrorData,
        raw_response: httpx.Response,
        body: Optional[str] = None,
    ):
        fallback = body or raw_response.text
        message = str(data.message) or fallback
        super().__init__(message, raw_response, body)
        object.__setattr__(self, "data", data)


class EnvelopeItemUpdateManyUnauthorizedIssueTypedDict(TypedDict):
    message: str


class EnvelopeItemUpdateManyUnauthorizedIssue(BaseModel):
    message: str


class EnvelopeItemUpdateManyUnauthorizedErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[EnvelopeItemUpdateManyUnauthorizedIssue]] = None


@dataclass(unsafe_hash=True)
class EnvelopeItemUpdateManyUnauthorizedError(DocumensoError):
    r"""Authorization not provided"""

    data: EnvelopeItemUpdateManyUnauthorizedErrorData = field(hash=False)

    def __init__(
        self,
        data: EnvelopeItemUpdateManyUnauthorizedErrorData,
        raw_response: httpx.Response,
        body: Optional[str] = None,
    ):
        fallback = body or raw_response.text
        message = str(data.message) or fallback
        super().__init__(message, raw_response, body)
        object.__setattr__(self, "data", data)


class EnvelopeItemUpdateManyBadRequestIssueTypedDict(TypedDict):
    message: str


class EnvelopeItemUpdateManyBadRequestIssue(BaseModel):
    message: str


class EnvelopeItemUpdateManyBadRequestErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[EnvelopeItemUpdateManyBadRequestIssue]] = None


@dataclass(unsafe_hash=True)
class EnvelopeItemUpdateManyBadRequestError(DocumensoError):
    r"""Invalid input data"""

    data: EnvelopeItemUpdateManyBadRequestErrorData = field(hash=False)

    def __init__(
        self,
        data: EnvelopeItemUpdateManyBadRequestErrorData,
        raw_response: httpx.Response,
        body: Optional[str] = None,
    ):
        fallback = body or raw_response.text
        message = str(data.message) or fallback
        super().__init__(message, raw_response, body)
        object.__setattr__(self, "data", data)


class EnvelopeItemUpdateManyDataResponseTypedDict(TypedDict):
    id: str
    order: float
    title: str
    envelope_id: str


class EnvelopeItemUpdateManyDataResponse(BaseModel):
    id: str

    order: float

    title: str

    envelope_id: Annotated[str, pydantic.Field(alias="envelopeId")]


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

    data: List[EnvelopeItemUpdateManyDataResponseTypedDict]


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

    data: List[EnvelopeItemUpdateManyDataResponse]
