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


class DocumentAttachmentFindRequestTypedDict(TypedDict):
    document_id: float


class DocumentAttachmentFindRequest(BaseModel):
    document_id: Annotated[
        float,
        pydantic.Field(alias="documentId"),
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ]


class DocumentAttachmentFindInternalServerErrorIssueTypedDict(TypedDict):
    message: str


class DocumentAttachmentFindInternalServerErrorIssue(BaseModel):
    message: str


class DocumentAttachmentFindInternalServerErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[DocumentAttachmentFindInternalServerErrorIssue]] = None


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

    data: DocumentAttachmentFindInternalServerErrorData = field(hash=False)

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


class DocumentAttachmentFindNotFoundIssue(BaseModel):
    message: str


class DocumentAttachmentFindNotFoundErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[DocumentAttachmentFindNotFoundIssue]] = None


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

    data: DocumentAttachmentFindNotFoundErrorData = field(hash=False)

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


class DocumentAttachmentFindForbiddenIssue(BaseModel):
    message: str


class DocumentAttachmentFindForbiddenErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[DocumentAttachmentFindForbiddenIssue]] = None


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

    data: DocumentAttachmentFindForbiddenErrorData = field(hash=False)

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


class DocumentAttachmentFindUnauthorizedIssue(BaseModel):
    message: str


class DocumentAttachmentFindUnauthorizedErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[DocumentAttachmentFindUnauthorizedIssue]] = None


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

    data: DocumentAttachmentFindUnauthorizedErrorData = field(hash=False)

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


class DocumentAttachmentFindBadRequestIssue(BaseModel):
    message: str


class DocumentAttachmentFindBadRequestErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[DocumentAttachmentFindBadRequestIssue]] = None


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

    data: DocumentAttachmentFindBadRequestErrorData = field(hash=False)

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


class DocumentAttachmentFindDataTypedDict(TypedDict):
    id: str
    type: DocumentAttachmentFindType
    label: str
    data: str


class DocumentAttachmentFindData(BaseModel):
    id: str

    type: DocumentAttachmentFindType

    label: str

    data: str


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

    data: List[DocumentAttachmentFindDataTypedDict]


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

    data: List[DocumentAttachmentFindData]
