"""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, TypedDict


class EnvelopeAttachmentCreateDataTypedDict(TypedDict):
    label: str
    data: str


class EnvelopeAttachmentCreateData(BaseModel):
    label: str

    data: str


class EnvelopeAttachmentCreateRequestTypedDict(TypedDict):
    envelope_id: str
    data: EnvelopeAttachmentCreateDataTypedDict


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

    data: EnvelopeAttachmentCreateData


class EnvelopeAttachmentCreateInternalServerErrorIssueTypedDict(TypedDict):
    message: str


class EnvelopeAttachmentCreateInternalServerErrorIssue(BaseModel):
    message: str


class EnvelopeAttachmentCreateInternalServerErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[EnvelopeAttachmentCreateInternalServerErrorIssue]] = None


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

    data: EnvelopeAttachmentCreateInternalServerErrorData = field(hash=False)

    def __init__(
        self,
        data: EnvelopeAttachmentCreateInternalServerErrorData,
        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 EnvelopeAttachmentCreateForbiddenIssueTypedDict(TypedDict):
    message: str


class EnvelopeAttachmentCreateForbiddenIssue(BaseModel):
    message: str


class EnvelopeAttachmentCreateForbiddenErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[EnvelopeAttachmentCreateForbiddenIssue]] = None


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

    data: EnvelopeAttachmentCreateForbiddenErrorData = field(hash=False)

    def __init__(
        self,
        data: EnvelopeAttachmentCreateForbiddenErrorData,
        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 EnvelopeAttachmentCreateUnauthorizedIssueTypedDict(TypedDict):
    message: str


class EnvelopeAttachmentCreateUnauthorizedIssue(BaseModel):
    message: str


class EnvelopeAttachmentCreateUnauthorizedErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[EnvelopeAttachmentCreateUnauthorizedIssue]] = None


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

    data: EnvelopeAttachmentCreateUnauthorizedErrorData = field(hash=False)

    def __init__(
        self,
        data: EnvelopeAttachmentCreateUnauthorizedErrorData,
        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 EnvelopeAttachmentCreateBadRequestIssueTypedDict(TypedDict):
    message: str


class EnvelopeAttachmentCreateBadRequestIssue(BaseModel):
    message: str


class EnvelopeAttachmentCreateBadRequestErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[EnvelopeAttachmentCreateBadRequestIssue]] = None


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

    data: EnvelopeAttachmentCreateBadRequestErrorData = field(hash=False)

    def __init__(
        self,
        data: EnvelopeAttachmentCreateBadRequestErrorData,
        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 EnvelopeAttachmentCreateResponseTypedDict(TypedDict):
    r"""Successful response"""

    id: str


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

    id: str
