"""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 TemplateCreateTemplateDirectLinkRequestTypedDict(TypedDict):
    template_id: float
    direct_recipient_id: NotRequired[float]


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

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


class TemplateCreateTemplateDirectLinkInternalServerErrorIssueTypedDict(TypedDict):
    message: str


class TemplateCreateTemplateDirectLinkInternalServerErrorIssue(BaseModel):
    message: str


class TemplateCreateTemplateDirectLinkInternalServerErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[TemplateCreateTemplateDirectLinkInternalServerErrorIssue]] = (
        None
    )


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

    data: TemplateCreateTemplateDirectLinkInternalServerErrorData = field(hash=False)

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


class TemplateCreateTemplateDirectLinkForbiddenIssue(BaseModel):
    message: str


class TemplateCreateTemplateDirectLinkForbiddenErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[TemplateCreateTemplateDirectLinkForbiddenIssue]] = None


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

    data: TemplateCreateTemplateDirectLinkForbiddenErrorData = field(hash=False)

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


class TemplateCreateTemplateDirectLinkUnauthorizedIssue(BaseModel):
    message: str


class TemplateCreateTemplateDirectLinkUnauthorizedErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[TemplateCreateTemplateDirectLinkUnauthorizedIssue]] = None


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

    data: TemplateCreateTemplateDirectLinkUnauthorizedErrorData = field(hash=False)

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


class TemplateCreateTemplateDirectLinkBadRequestIssue(BaseModel):
    message: str


class TemplateCreateTemplateDirectLinkBadRequestErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[TemplateCreateTemplateDirectLinkBadRequestIssue]] = None


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

    data: TemplateCreateTemplateDirectLinkBadRequestErrorData = field(hash=False)

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

    id: str
    token: str
    created_at: str
    enabled: bool
    direct_template_recipient_id: float
    envelope_id: str
    template_id: float


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

    id: str

    token: str

    created_at: Annotated[str, pydantic.Field(alias="createdAt")]

    enabled: bool

    direct_template_recipient_id: Annotated[
        float, pydantic.Field(alias="directTemplateRecipientId")
    ]

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

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