"""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
from documenso_sdk.utils import FieldMetadata, QueryParamMetadata
from enum import Enum
import httpx
import pydantic
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class EnvelopeAttachmentFindRequestTypedDict(TypedDict):
    envelope_id: str
    token: NotRequired[str]


class EnvelopeAttachmentFindRequest(BaseModel):
    envelope_id: Annotated[
        str,
        pydantic.Field(alias="envelopeId"),
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ]

    token: Annotated[
        Optional[str],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = None


class EnvelopeAttachmentFindInternalServerErrorIssueTypedDict(TypedDict):
    message: str


class EnvelopeAttachmentFindInternalServerErrorIssue(BaseModel):
    message: str


class EnvelopeAttachmentFindInternalServerErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[EnvelopeAttachmentFindInternalServerErrorIssue]] = None


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

    data: EnvelopeAttachmentFindInternalServerErrorData = field(hash=False)

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


class EnvelopeAttachmentFindNotFoundIssue(BaseModel):
    message: str


class EnvelopeAttachmentFindNotFoundErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[EnvelopeAttachmentFindNotFoundIssue]] = None


@dataclass(unsafe_hash=True)
class EnvelopeAttachmentFindNotFoundError(DocumensoError):
    r"""Not found"""

    data: EnvelopeAttachmentFindNotFoundErrorData = field(hash=False)

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


class EnvelopeAttachmentFindForbiddenIssue(BaseModel):
    message: str


class EnvelopeAttachmentFindForbiddenErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[EnvelopeAttachmentFindForbiddenIssue]] = None


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

    data: EnvelopeAttachmentFindForbiddenErrorData = field(hash=False)

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


class EnvelopeAttachmentFindUnauthorizedIssue(BaseModel):
    message: str


class EnvelopeAttachmentFindUnauthorizedErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[EnvelopeAttachmentFindUnauthorizedIssue]] = None


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

    data: EnvelopeAttachmentFindUnauthorizedErrorData = field(hash=False)

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


class EnvelopeAttachmentFindBadRequestIssue(BaseModel):
    message: str


class EnvelopeAttachmentFindBadRequestErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[EnvelopeAttachmentFindBadRequestIssue]] = None


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

    data: EnvelopeAttachmentFindBadRequestErrorData = field(hash=False)

    def __init__(
        self,
        data: EnvelopeAttachmentFindBadRequestErrorData,
        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 EnvelopeAttachmentFindType(str, Enum):
    LINK = "link"


class EnvelopeAttachmentFindDataTypedDict(TypedDict):
    id: str
    type: EnvelopeAttachmentFindType
    label: str
    data: str


class EnvelopeAttachmentFindData(BaseModel):
    id: str

    type: EnvelopeAttachmentFindType

    label: str

    data: str


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

    data: List[EnvelopeAttachmentFindDataTypedDict]


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

    data: List[EnvelopeAttachmentFindData]
