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

from __future__ import annotations
from datetime import datetime
from moovio_sdk import utils
from moovio_sdk.models.components import (
    amount as components_amount,
    refundcarddetails as components_refundcarddetails,
    refundstatus as components_refundstatus,
)
from moovio_sdk.types import BaseModel
import pydantic
from typing import Optional
from typing_extensions import Annotated


class CardAcquiringRefundData(BaseModel):
    refund_id: Annotated[str, pydantic.Field(alias="refundID")]
    r"""Identifier for the refund."""

    created_on: Annotated[datetime, pydantic.Field(alias="createdOn")]

    updated_on: Annotated[datetime, pydantic.Field(alias="updatedOn")]

    status: components_refundstatus.RefundStatus

    amount: components_amount.Amount

    card_details: Annotated[
        Optional[components_refundcarddetails.RefundCardDetails],
        pydantic.Field(alias="cardDetails"),
    ] = None


class CardAcquiringRefund(Exception):
    r"""Details of a card refund."""

    data: CardAcquiringRefundData

    def __init__(self, data: CardAcquiringRefundData):
        self.data = data

    def __str__(self) -> str:
        return utils.marshal_json(self.data, CardAcquiringRefundData)
