# Path: mollie/api/error.py
# class DataConsistencyError(Error):
#     """We could not process the API response due to an inconsistency.
# 
#     We received different data than expected from the API.
#     """
# 
#     pass
# 
# Path: mollie/api/objects/base.py
# class ObjectBase(dict):
#     def __init__(self, data, client=None):
#         """
#         Create a new object from API result data.
#         """
#         super().__init__(data)
#         self.client = client
# 
#     def _get_property(self, name):
#         """Return the named property from dictionary values."""
#         if name not in self:
#             return None
#         return self[name]
# 
#     def _get_link(self, name):
#         """Return a link by its name."""
#         try:
#             return self["_links"][name]["href"]
#         except (KeyError, TypeError):
#             return None
# 
#     @classmethod
#     def get_object_name(cls):
#         name = cls.__name__.lower()
#         return f"{name}s"
# 
#     @classmethod
#     def get_resource_class(cls, client):
#         raise NotImplementedError  # pragma: no cover


import re
from ..error import DataConsistencyError
from .base import ObjectBase
        from ..resources.chargebacks import Chargebacks
        return self._get_property("createdAt")

    @property
    def reason(self):
        return self._get_property("reason")

    @property
    def reversed_at(self):
        return self._get_property("reversedAt")

    @property
    def payment_id(self):
        return self._get_property("paymentId")

    @property
    def payment(self):
        """Return the Payment object related to this chargeback."""
        # TODO Use the embedded payment data, if available.
        return self.client.payments.get(self.payment_id)

    @property
    def settlement(self):
        """Return the Settlement object related to this chargeback, if available."""
        url = self._get_link("settlement")
        if not url:
            return None

        match = re.search(r"settlements/(stl_[a-zA-Z0-9]+)$", url)
        if not match:
            # This should never happen

# Path: mollie/api/error.py
# class DataConsistencyError(Error):
#     """We could not process the API response due to an inconsistency.
# 
#     We received different data than expected from the API.
#     """
# 
#     pass
# 
# Path: mollie/api/objects/base.py
# class ObjectBase(dict):
#     def __init__(self, data, client=None):
#         """
#         Create a new object from API result data.
#         """
#         super().__init__(data)
#         self.client = client
# 
#     def _get_property(self, name):
#         """Return the named property from dictionary values."""
#         if name not in self:
#             return None
#         return self[name]
# 
#     def _get_link(self, name):
#         """Return a link by its name."""
#         try:
#             return self["_links"][name]["href"]
#         except (KeyError, TypeError):
#             return None
# 
#     @classmethod
#     def get_object_name(cls):
#         name = cls.__name__.lower()
#         return f"{name}s"
# 
#     @classmethod
#     def get_resource_class(cls, client):
#         raise NotImplementedError  # pragma: no cover


# Path: mollie/api/objects/chargeback.py
import re
from ..error import DataConsistencyError
from .base import ObjectBase
        from ..resources.chargebacks import Chargebacks

        return self._get_property("createdAt")

    @property
    def reason(self):
        return self._get_property("reason")

    @property
    def reversed_at(self):
        return self._get_property("reversedAt")

    @property
    def payment_id(self):
        return self._get_property("paymentId")

    @property
    def payment(self):
        """Return the Payment object related to this chargeback."""
        # TODO Use the embedded payment data, if available.
        return self.client.payments.get(self.payment_id)

    @property
    def settlement(self):
        """Return the Settlement object related to this chargeback, if available."""
        url = self._get_link("settlement")
        if not url:
            return None

        match = re.search(r"settlements/(stl_[a-zA-Z0-9]+)$", url)
        if not match:
            # This should never happen

            raise DataConsistencyError("Unable to extract the settlementId from settlement URL.")  # pragma: no cover