# Path: mollie/api/objects/refund.py
# class Refund(ObjectBase):
#     @classmethod
#     def get_resource_class(cls, client):
#         from ..resources.refunds import Refunds
# 
#         return Refunds(client)
# 
#     STATUS_QUEUED = "queued"
#     STATUS_PENDING = "pending"
#     STATUS_PROCESSING = "processing"
#     STATUS_REFUNDED = "refunded"
# 
#     # documented properties
# 
#     @property
#     def resource(self):
#         return self._get_property("resource")
# 
#     @property
#     def id(self):
#         return self._get_property("id")
# 
#     @property
#     def amount(self):
#         return self._get_property("amount")
# 
#     @property
#     def settlement_id(self):
#         return self._get_property("settlementId")
# 
#     @property
#     def settlement_amount(self):
#         return self._get_property("settlementAmount")
# 
#     @property
#     def description(self):
#         return self._get_property("description")
# 
#     @property
#     def status(self):
#         return self._get_property("status")
# 
#     @property
#     def lines(self):
#         """Return the lines for this refund."""
#         lines = self._get_property("lines") or []
#         result = {
#             "_embedded": {
#                 "lines": lines,
#             },
#             "count": len(lines),
#         }
#         return ObjectList(result, OrderLine, self.client)
# 
#     @property
#     def payment_id(self):
#         return self._get_property("paymentId")
# 
#     @property
#     def order_id(self):
#         return self._get_property("orderId")
# 
#     @property
#     def created_at(self):
#         return self._get_property("createdAt")
# 
#     @property
#     def metadata(self):
#         return self._get_property("metadata")
# 
#     # documented _links
# 
#     @property
#     def payment(self):
#         """Return the payment for this refund."""
#         return self.client.payments.get(self.payment_id)
# 
#     @property
#     def settlement(self):
#         """Return the settlement for this refund."""
#         if self.settlement_id:
#             return self.client.settlements.get(self.settlement_id)
#         return None
# 
#     @property
#     def order(self):
#         """Return the order for this refund."""
#         if self.order_id:
#             return self.client.orders.get(self.order_id)
#         return None
# 
#     # additional methods
# 
#     def is_queued(self):
#         return self.status == self.STATUS_QUEUED
# 
#     def is_pending(self):
#         return self.status == self.STATUS_PENDING
# 
#     def is_processing(self):
#         return self.status == self.STATUS_PROCESSING
# 
#     def is_refunded(self):
#         return self.status == self.STATUS_REFUNDED
# 
# Path: tests/utils.py
# def assert_list_object(obj, object_type, count=None):
#     """Assert that a List object is correctly working, and has sane contents."""
#     assert isinstance(obj, ObjectList), f"Object {obj} is not a ObjectList instance."
#     assert isinstance(obj.count, int), "ObjectList count is not an integer."
#     if count is not None:
#         assert obj.count == count, "ObjectList does not contain the expected number of items."
#     else:
#         assert obj.count > 0, "ObjectList has no items."
# 
#     # verify items in list
#     items = []
#     for item in obj:
#         assert isinstance(item, object_type)
#         assert item.id is not None
#         items.append(item.id)
# 
#     assert len(items) == obj.count, "Items in ObjectList don't match list count."
#     assert len(set(items)) == obj.count, "Not all object ids in the ObjectList are unique."


from mollie.api.objects.refund import Refund
from .utils import assert_list_object


PROFILE_ID = "pfl_v9hTwCvYqw"


def test_get_profile_refunds_by_profile_id(client, response):
    """Get refunds relevant to profile by profile id."""
    response.get(f"https://api.mollie.com/v2/refunds?profileId={PROFILE_ID}", "refunds_list")

    refunds = client.profile_refunds.with_parent_id(PROFILE_ID).list()

# Path: mollie/api/objects/refund.py
# class Refund(ObjectBase):
#     @classmethod
#     def get_resource_class(cls, client):
#         from ..resources.refunds import Refunds
# 
#         return Refunds(client)
# 
#     STATUS_QUEUED = "queued"
#     STATUS_PENDING = "pending"
#     STATUS_PROCESSING = "processing"
#     STATUS_REFUNDED = "refunded"
# 
#     # documented properties
# 
#     @property
#     def resource(self):
#         return self._get_property("resource")
# 
#     @property
#     def id(self):
#         return self._get_property("id")
# 
#     @property
#     def amount(self):
#         return self._get_property("amount")
# 
#     @property
#     def settlement_id(self):
#         return self._get_property("settlementId")
# 
#     @property
#     def settlement_amount(self):
#         return self._get_property("settlementAmount")
# 
#     @property
#     def description(self):
#         return self._get_property("description")
# 
#     @property
#     def status(self):
#         return self._get_property("status")
# 
#     @property
#     def lines(self):
#         """Return the lines for this refund."""
#         lines = self._get_property("lines") or []
#         result = {
#             "_embedded": {
#                 "lines": lines,
#             },
#             "count": len(lines),
#         }
#         return ObjectList(result, OrderLine, self.client)
# 
#     @property
#     def payment_id(self):
#         return self._get_property("paymentId")
# 
#     @property
#     def order_id(self):
#         return self._get_property("orderId")
# 
#     @property
#     def created_at(self):
#         return self._get_property("createdAt")
# 
#     @property
#     def metadata(self):
#         return self._get_property("metadata")
# 
#     # documented _links
# 
#     @property
#     def payment(self):
#         """Return the payment for this refund."""
#         return self.client.payments.get(self.payment_id)
# 
#     @property
#     def settlement(self):
#         """Return the settlement for this refund."""
#         if self.settlement_id:
#             return self.client.settlements.get(self.settlement_id)
#         return None
# 
#     @property
#     def order(self):
#         """Return the order for this refund."""
#         if self.order_id:
#             return self.client.orders.get(self.order_id)
#         return None
# 
#     # additional methods
# 
#     def is_queued(self):
#         return self.status == self.STATUS_QUEUED
# 
#     def is_pending(self):
#         return self.status == self.STATUS_PENDING
# 
#     def is_processing(self):
#         return self.status == self.STATUS_PROCESSING
# 
#     def is_refunded(self):
#         return self.status == self.STATUS_REFUNDED
# 
# Path: tests/utils.py
# def assert_list_object(obj, object_type, count=None):
#     """Assert that a List object is correctly working, and has sane contents."""
#     assert isinstance(obj, ObjectList), f"Object {obj} is not a ObjectList instance."
#     assert isinstance(obj.count, int), "ObjectList count is not an integer."
#     if count is not None:
#         assert obj.count == count, "ObjectList does not contain the expected number of items."
#     else:
#         assert obj.count > 0, "ObjectList has no items."
# 
#     # verify items in list
#     items = []
#     for item in obj:
#         assert isinstance(item, object_type)
#         assert item.id is not None
#         items.append(item.id)
# 
#     assert len(items) == obj.count, "Items in ObjectList don't match list count."
#     assert len(set(items)) == obj.count, "Not all object ids in the ObjectList are unique."


# Path: tests/test_profile_refunds.py
from mollie.api.objects.refund import Refund
from .utils import assert_list_object



PROFILE_ID = "pfl_v9hTwCvYqw"


def test_get_profile_refunds_by_profile_id(client, response):
    """Get refunds relevant to profile by profile id."""
    response.get(f"https://api.mollie.com/v2/refunds?profileId={PROFILE_ID}", "refunds_list")

    refunds = client.profile_refunds.with_parent_id(PROFILE_ID).list()

    assert_list_object(refunds, Refund)