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

from __future__ import annotations
from dataclasses import dataclass, field
import httpx
from moovio_sdk.models.components import (
    cardexpirationerror as components_cardexpirationerror,
    createauthorizedusererror as components_createauthorizedusererror,
    issuingcontrolserror as components_issuingcontrolserror,
)
from moovio_sdk.models.errors import MoovError
from moovio_sdk.types import BaseModel
import pydantic
from typing import Optional
from typing_extensions import Annotated


class RequestCardErrorData(BaseModel):
    funding_wallet_id: Annotated[
        Optional[str], pydantic.Field(alias="fundingWalletID")
    ] = None
    form_factor: Annotated[Optional[str], pydantic.Field(alias="formFactor")] = None
    authorized_user: Annotated[
        Optional[components_createauthorizedusererror.CreateAuthorizedUserError],
        pydantic.Field(alias="authorizedUser"),
    ] = None
    memo: Optional[str] = None
    expiration: Optional[components_cardexpirationerror.CardExpirationError] = None
    controls: Optional[components_issuingcontrolserror.IssuingControlsError] = None


@dataclass(unsafe_hash=True)
class RequestCardError(MoovError):
    data: RequestCardErrorData = field(hash=False)

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