"""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 (
    createtransferlineitemsvalidationerror as components_createtransferlineitemsvalidationerror,
)
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 TransferValidationErrorData(BaseModel):
    amount: Optional[str] = None
    source: Optional[str] = None
    source_payment_method_id: Annotated[
        Optional[str], pydantic.Field(alias="sourcePaymentMethodID")
    ] = None
    destination_payment_method_id: Annotated[
        Optional[str], pydantic.Field(alias="destinationPaymentMethodID")
    ] = None
    description: Optional[str] = None
    facilitator_fee_total_decimal: Annotated[
        Optional[str], pydantic.Field(alias="FacilitatorFee.TotalDecimal")
    ] = None
    facilitator_fee_markup_decimal: Annotated[
        Optional[str], pydantic.Field(alias="FacilitatorFee.MarkupDecimal")
    ] = None
    metadata: Optional[str] = None
    sales_tax_amount: Annotated[
        Optional[str], pydantic.Field(alias="salesTaxAmount")
    ] = None
    foreign_id: Annotated[Optional[str], pydantic.Field(alias="foreignID")] = None
    line_items: Annotated[
        Optional[
            components_createtransferlineitemsvalidationerror.CreateTransferLineItemsValidationError
        ],
        pydantic.Field(alias="lineItems"),
    ] = None


@dataclass(unsafe_hash=True)
class TransferValidationError(MoovError):
    data: TransferValidationErrorData = field(hash=False)

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