"""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 EnvelopeRedistributeRequestTypedDict(TypedDict):
    envelope_id: str
    recipients: List[float]


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

    recipients: List[float]


class EnvelopeRedistributeInternalServerErrorIssueTypedDict(TypedDict):
    message: str


class EnvelopeRedistributeInternalServerErrorIssue(BaseModel):
    message: str


class EnvelopeRedistributeInternalServerErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[EnvelopeRedistributeInternalServerErrorIssue]] = None


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

    data: EnvelopeRedistributeInternalServerErrorData = field(hash=False)

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


class EnvelopeRedistributeForbiddenIssue(BaseModel):
    message: str


class EnvelopeRedistributeForbiddenErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[EnvelopeRedistributeForbiddenIssue]] = None


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

    data: EnvelopeRedistributeForbiddenErrorData = field(hash=False)

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


class EnvelopeRedistributeUnauthorizedIssue(BaseModel):
    message: str


class EnvelopeRedistributeUnauthorizedErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[EnvelopeRedistributeUnauthorizedIssue]] = None


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

    data: EnvelopeRedistributeUnauthorizedErrorData = field(hash=False)

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


class EnvelopeRedistributeBadRequestIssue(BaseModel):
    message: str


class EnvelopeRedistributeBadRequestErrorData(BaseModel):
    message: str

    code: str

    issues: Optional[List[EnvelopeRedistributeBadRequestIssue]] = None


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

    data: EnvelopeRedistributeBadRequestErrorData = field(hash=False)

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

    success: bool


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

    success: bool
