# This file was auto-generated by Fern from our API Definition.

from ......core.pydantic_utilities import UniversalBaseModel
import uuid
import typing
from .....commons.types.charge_capture_id import ChargeCaptureId
import pydantic
from .....commons.types.charge_capture_bundle_id import ChargeCaptureBundleId
from ......core.pydantic_utilities import IS_PYDANTIC_V2


class ChargeBundleError(UniversalBaseModel):
    id: uuid.UUID
    charge_capture_id: typing.Optional[ChargeCaptureId] = pydantic.Field(default=None)
    """
    The underlying Charge Capture that this error object references.
    The Charge Capture referenced will be a part of the bundle tied to this error.
    Errors may also refer to all charge_captures present in a bundle, in which case this field will be null.
    """

    message: str = pydantic.Field()
    """
    A human readable error explaining why this charge capture bundle failed to create a claim.
    """

    field_in_error: typing.Optional[str] = pydantic.Field(default=None)
    """
    The field of the corresponding underlying ChargeCapture that has a field that is failing validations,
    is not present but marked as required, or otherwise in error.
    """

    bundle_id: ChargeCaptureBundleId = pydantic.Field()
    """
    The ID of the ChargeCaptureBundle associated with this Error.
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
