"""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 TemplateToggleTemplateDirectLinkRequestTypedDict(TypedDict):
    template_id: float
    enabled: bool


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

    enabled: bool


class TemplateToggleTemplateDirectLinkInternalServerErrorIssueTypedDict(TypedDict):
    message: str


class TemplateToggleTemplateDirectLinkInternalServerErrorIssue(BaseModel):
    message: str


class TemplateToggleTemplateDirectLinkInternalServerErrorData(BaseModel):
    message: str

    code: str

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


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

    data: TemplateToggleTemplateDirectLinkInternalServerErrorData = field(hash=False)

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


class TemplateToggleTemplateDirectLinkForbiddenIssue(BaseModel):
    message: str


class TemplateToggleTemplateDirectLinkForbiddenErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[TemplateToggleTemplateDirectLinkForbiddenIssue]] = None


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

    data: TemplateToggleTemplateDirectLinkForbiddenErrorData = field(hash=False)

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


class TemplateToggleTemplateDirectLinkUnauthorizedIssue(BaseModel):
    message: str


class TemplateToggleTemplateDirectLinkUnauthorizedErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[TemplateToggleTemplateDirectLinkUnauthorizedIssue]] = None


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

    data: TemplateToggleTemplateDirectLinkUnauthorizedErrorData = field(hash=False)

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


class TemplateToggleTemplateDirectLinkBadRequestIssue(BaseModel):
    message: str


class TemplateToggleTemplateDirectLinkBadRequestErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[TemplateToggleTemplateDirectLinkBadRequestIssue]] = None


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

    data: TemplateToggleTemplateDirectLinkBadRequestErrorData = field(hash=False)

    def __init__(
        self,
        data: TemplateToggleTemplateDirectLinkBadRequestErrorData,
        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 TemplateToggleTemplateDirectLinkResponseTypedDict(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 TemplateToggleTemplateDirectLinkResponse(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")]
