"""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 (
    cardvolumedistributionerror as components_cardvolumedistributionerror,
    collectfundserror as components_collectfundserror,
    fulfillmentdetailserror as components_fulfillmentdetailserror,
    moneytransfererror as components_moneytransfererror,
    sendfundserror as components_sendfundserror,
    volumebycustomertypeerror as components_volumebycustomertypeerror,
    volumesharebycustomertypeerror as components_volumesharebycustomertypeerror,
)
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 UpsertUnderwritingErrorData(BaseModel):
    geographic_reach: Annotated[
        Optional[str], pydantic.Field(alias="geographicReach")
    ] = None
    business_presence: Annotated[
        Optional[str], pydantic.Field(alias="businessPresence")
    ] = None
    pending_litigation: Annotated[
        Optional[str], pydantic.Field(alias="pendingLitigation")
    ] = None
    volume_share_by_customer_type: Annotated[
        Optional[
            components_volumesharebycustomertypeerror.VolumeShareByCustomerTypeError
        ],
        pydantic.Field(alias="volumeShareByCustomerType"),
    ] = None
    collect_funds: Annotated[
        Optional[components_collectfundserror.CollectFundsError],
        pydantic.Field(alias="collectFunds"),
    ] = None
    money_transfer: Annotated[
        Optional[components_moneytransfererror.MoneyTransferError],
        pydantic.Field(alias="moneyTransfer"),
    ] = None
    send_funds: Annotated[
        Optional[components_sendfundserror.SendFundsError],
        pydantic.Field(alias="sendFunds"),
    ] = None
    average_monthly_transaction_volume: Annotated[
        Optional[str], pydantic.Field(alias="averageMonthlyTransactionVolume")
    ] = None
    error: Optional[str] = None
    average_transaction_size: Annotated[
        Optional[str], pydantic.Field(alias="averageTransactionSize")
    ] = None
    max_transaction_size: Annotated[
        Optional[str], pydantic.Field(alias="maxTransactionSize")
    ] = None
    volume_by_customer_type: Annotated[
        Optional[components_volumebycustomertypeerror.VolumeByCustomerTypeError],
        pydantic.Field(alias="volumeByCustomerType"),
    ] = None
    card_volume_distribution: Annotated[
        Optional[components_cardvolumedistributionerror.CardVolumeDistributionError],
        pydantic.Field(alias="cardVolumeDistribution"),
    ] = None
    fulfillment: Optional[
        components_fulfillmentdetailserror.FulfillmentDetailsError
    ] = None


@dataclass(unsafe_hash=True)
class UpsertUnderwritingError(MoovError):
    data: UpsertUnderwritingErrorData = field(hash=False)

    def __init__(
        self,
        data: UpsertUnderwritingErrorData,
        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)
