"""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 (
    amountvalidationerror as components_amountvalidationerror,
    createpaymentlinklineitemsvalidationerror as components_createpaymentlinklineitemsvalidationerror,
    displayoptionserror as components_displayoptionserror,
    paymentdetailserror as components_paymentdetailserror,
    payoutdetailserror as components_payoutdetailserror,
)
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 UpdatePaymentLinkErrorData(BaseModel):
    amount: Optional[components_amountvalidationerror.AmountValidationError] = None
    sales_tax_amount: Annotated[
        Optional[components_amountvalidationerror.AmountValidationError],
        pydantic.Field(alias="salesTaxAmount"),
    ] = None
    expires_on: Annotated[Optional[str], pydantic.Field(alias="expiresOn")] = None
    display: Optional[components_displayoptionserror.DisplayOptionsError] = None
    payment: Optional[components_paymentdetailserror.PaymentDetailsError] = None
    payout: Optional[components_payoutdetailserror.PayoutDetailsError] = None
    line_items: Annotated[
        Optional[
            components_createpaymentlinklineitemsvalidationerror.CreatePaymentLinkLineItemsValidationError
        ],
        pydantic.Field(alias="lineItems"),
    ] = None


@dataclass(unsafe_hash=True)
class UpdatePaymentLinkError(MoovError):
    data: UpdatePaymentLinkErrorData = field(hash=False)

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