"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from .problemdetails import ProblemDetails
import httpx
import pydantic
from ttd_workflows.models import WorkflowsError
from ttd_workflows.types import BaseModel, OptionalNullable, UNSET
from typing import Dict, Optional
from typing_extensions import Annotated


class ProblemDetailsErrorData(BaseModel):
    type: OptionalNullable[str] = UNSET

    title: OptionalNullable[str] = UNSET

    status: OptionalNullable[int] = UNSET

    detail: OptionalNullable[str] = UNSET

    instance: OptionalNullable[str] = UNSET

    additional_properties: Annotated[
        Optional[Dict[str, ProblemDetails]], pydantic.Field(exclude=True)
    ] = None


class ProblemDetailsError(WorkflowsError):
    data: ProblemDetailsErrorData

    def __init__(
        self,
        data: ProblemDetailsErrorData,
        raw_response: httpx.Response,
        body: Optional[str] = None,
    ):
        message = body or raw_response.text
        super().__init__(message, raw_response, body)
        self.data = data
