# Path: mollie/api/error.py
# class IdentifierError(RequestSetupError):
#     """Errors related to invalid resource identifiers that will be requested from the API."""
# 
#     pass
# 
# Path: mollie/api/objects/onboarding.py
# class Onboarding(ObjectBase):
#     @classmethod
#     def get_resource_class(cls, client):
#         from ..resources.onboarding import Onboarding as OnboardingResource
# 
#         return OnboardingResource(client)
# 
#     STATUS_NEEDS_DATA = "needs-data"
#     STATUS_IN_REVIEW = "in-review"  # Waiting for a valid mandate.
#     STATUS_COMPLETED = "completed"
# 
#     @property
#     def resource(self):
#         return self._get_property("resource")
# 
#     @property
#     def name(self):
#         return self._get_property("name")
# 
#     @property
#     def signed_up_at(self):
#         return self._get_property("signedUpAt")
# 
#     @property
#     def status(self):
#         return self._get_property("status")
# 
#     @property
#     def can_receive_payments(self):
#         return self._get_property("canReceivePayments")
# 
#     @property
#     def can_receive_settlements(self):
#         return self._get_property("canReceiveSettlements")
# 
#     @property
#     def organization(self):
#         """Retrieve organization for an onboarding."""
#         url = self._get_link("organization")
#         if url:
#             return self.client.organizations.from_url(url)
# 
#     def is_needs_data(self):
#         return self.status == self.STATUS_NEEDS_DATA
# 
#     def is_in_review(self):
#         return self.status == self.STATUS_IN_REVIEW
# 
#     def is_completed(self):
#         return self.status == self.STATUS_COMPLETED
# 
# Path: mollie/api/resources/base.py
# class ResourceBase(object):
#     REST_CREATE = "POST"
#     REST_UPDATE = "PATCH"
#     REST_READ = "GET"
#     REST_LIST = "GET"
#     REST_DELETE = "DELETE"
#     DEFAULT_LIMIT = 10
# 
#     def __init__(self, client):
#         self.client = client
# 
#     def get_resource_object(self, result):
#         raise NotImplementedError()  # pragma: no cover
# 
#     def get_resource_name(self):
#         return self.__class__.__name__.lower()
# 
#     def create(self, data=None, **params):
#         path = self.get_resource_name()
#         result = self.perform_api_call(self.REST_CREATE, path, data, params)
#         return self.get_resource_object(result)
# 
#     def get(self, resource_id, **params):
#         path = self.get_resource_name() + "/" + str(resource_id)
#         result = self.perform_api_call(self.REST_READ, path, params=params)
#         return self.get_resource_object(result)
# 
#     def update(self, resource_id, data=None, **params):
#         path = self.get_resource_name() + "/" + str(resource_id)
#         result = self.perform_api_call(self.REST_UPDATE, path, data, params)
#         return self.get_resource_object(result)
# 
#     def delete(self, resource_id, data=None):
#         path = self.get_resource_name() + "/" + str(resource_id)
#         return self.perform_api_call(self.REST_DELETE, path, data)
# 
#     def list(self, **params):
#         path = self.get_resource_name()
#         result = self.perform_api_call(self.REST_LIST, path, params=params)
#         return ObjectList(result, self.get_resource_object({}).__class__, self.client)
# 
#     def perform_api_call(self, http_method, path, data=None, params=None):
#         resp = self.client.perform_http_call(http_method, path, data, params)
#         if "application/hal+json" in resp.headers.get("Content-Type", ""):
#             # set the content type according to the media type definition
#             resp.encoding = "utf-8"
#         try:
#             result = resp.json() if resp.status_code != 204 else {}
#         except Exception:
#             raise ResponseHandlingError(
#                 f"Unable to decode Mollie API response (status code: {resp.status_code}): '{resp.text}'."
#             )
#         if resp.status_code < 200 or resp.status_code > 299:
#             if "status" in result and (result["status"] < 200 or result["status"] > 299):
#                 # the factory will return the appropriate ResponseError subclass based on the result
#                 raise ResponseError.factory(result)
#             else:
#                 raise ResponseHandlingError(
#                     "Received HTTP error from Mollie API, but no status in payload "
#                     f"(status code: {resp.status_code}): '{resp.text}'."
#                 )
#         return result
# 
#     def from_url(self, url, data=None, params=None):
#         """Utility method to return an object from a full URL (such as from _links).
# 
#         This method always does a GET request and returns a single Object.
#         """
#         result = self.perform_api_call(self.REST_READ, url, data, params)
#         return self.get_resource_object(result)
# 
#     @staticmethod
#     def extract_embed(params):
#         """Extract and parse the embed parameter from the request."""
#         if "embed" not in params:
#             return
#         return params["embed"].split(",")


from ..error import IdentifierError
from ..objects.onboarding import Onboarding as OnboardingObject
from .base import ResourceBase


class Onboarding(ResourceBase):
    def get_resource_object(self, result):
        return OnboardingObject(result, self.client)

    def get(self, onboarding_id, **params):
        if not onboarding_id or not onboarding_id == "me":
            raise IdentifierError(f"Invalid onboarding ID: '{onboarding_id}'. The onboarding ID should be 'me'.")
        return super().get(onboarding_id, **params)

    def create(self, resource_id, data=None, **params):
        path = self.get_resource_name() + "/" + str(resource_id)

# Path: mollie/api/error.py
# class IdentifierError(RequestSetupError):
#     """Errors related to invalid resource identifiers that will be requested from the API."""
# 
#     pass
# 
# Path: mollie/api/objects/onboarding.py
# class Onboarding(ObjectBase):
#     @classmethod
#     def get_resource_class(cls, client):
#         from ..resources.onboarding import Onboarding as OnboardingResource
# 
#         return OnboardingResource(client)
# 
#     STATUS_NEEDS_DATA = "needs-data"
#     STATUS_IN_REVIEW = "in-review"  # Waiting for a valid mandate.
#     STATUS_COMPLETED = "completed"
# 
#     @property
#     def resource(self):
#         return self._get_property("resource")
# 
#     @property
#     def name(self):
#         return self._get_property("name")
# 
#     @property
#     def signed_up_at(self):
#         return self._get_property("signedUpAt")
# 
#     @property
#     def status(self):
#         return self._get_property("status")
# 
#     @property
#     def can_receive_payments(self):
#         return self._get_property("canReceivePayments")
# 
#     @property
#     def can_receive_settlements(self):
#         return self._get_property("canReceiveSettlements")
# 
#     @property
#     def organization(self):
#         """Retrieve organization for an onboarding."""
#         url = self._get_link("organization")
#         if url:
#             return self.client.organizations.from_url(url)
# 
#     def is_needs_data(self):
#         return self.status == self.STATUS_NEEDS_DATA
# 
#     def is_in_review(self):
#         return self.status == self.STATUS_IN_REVIEW
# 
#     def is_completed(self):
#         return self.status == self.STATUS_COMPLETED
# 
# Path: mollie/api/resources/base.py
# class ResourceBase(object):
#     REST_CREATE = "POST"
#     REST_UPDATE = "PATCH"
#     REST_READ = "GET"
#     REST_LIST = "GET"
#     REST_DELETE = "DELETE"
#     DEFAULT_LIMIT = 10
# 
#     def __init__(self, client):
#         self.client = client
# 
#     def get_resource_object(self, result):
#         raise NotImplementedError()  # pragma: no cover
# 
#     def get_resource_name(self):
#         return self.__class__.__name__.lower()
# 
#     def create(self, data=None, **params):
#         path = self.get_resource_name()
#         result = self.perform_api_call(self.REST_CREATE, path, data, params)
#         return self.get_resource_object(result)
# 
#     def get(self, resource_id, **params):
#         path = self.get_resource_name() + "/" + str(resource_id)
#         result = self.perform_api_call(self.REST_READ, path, params=params)
#         return self.get_resource_object(result)
# 
#     def update(self, resource_id, data=None, **params):
#         path = self.get_resource_name() + "/" + str(resource_id)
#         result = self.perform_api_call(self.REST_UPDATE, path, data, params)
#         return self.get_resource_object(result)
# 
#     def delete(self, resource_id, data=None):
#         path = self.get_resource_name() + "/" + str(resource_id)
#         return self.perform_api_call(self.REST_DELETE, path, data)
# 
#     def list(self, **params):
#         path = self.get_resource_name()
#         result = self.perform_api_call(self.REST_LIST, path, params=params)
#         return ObjectList(result, self.get_resource_object({}).__class__, self.client)
# 
#     def perform_api_call(self, http_method, path, data=None, params=None):
#         resp = self.client.perform_http_call(http_method, path, data, params)
#         if "application/hal+json" in resp.headers.get("Content-Type", ""):
#             # set the content type according to the media type definition
#             resp.encoding = "utf-8"
#         try:
#             result = resp.json() if resp.status_code != 204 else {}
#         except Exception:
#             raise ResponseHandlingError(
#                 f"Unable to decode Mollie API response (status code: {resp.status_code}): '{resp.text}'."
#             )
#         if resp.status_code < 200 or resp.status_code > 299:
#             if "status" in result and (result["status"] < 200 or result["status"] > 299):
#                 # the factory will return the appropriate ResponseError subclass based on the result
#                 raise ResponseError.factory(result)
#             else:
#                 raise ResponseHandlingError(
#                     "Received HTTP error from Mollie API, but no status in payload "
#                     f"(status code: {resp.status_code}): '{resp.text}'."
#                 )
#         return result
# 
#     def from_url(self, url, data=None, params=None):
#         """Utility method to return an object from a full URL (such as from _links).
# 
#         This method always does a GET request and returns a single Object.
#         """
#         result = self.perform_api_call(self.REST_READ, url, data, params)
#         return self.get_resource_object(result)
# 
#     @staticmethod
#     def extract_embed(params):
#         """Extract and parse the embed parameter from the request."""
#         if "embed" not in params:
#             return
#         return params["embed"].split(",")


# Path: mollie/api/resources/onboarding.py
from ..error import IdentifierError
from ..objects.onboarding import Onboarding as OnboardingObject
from .base import ResourceBase



class Onboarding(ResourceBase):
    def get_resource_object(self, result):
        return OnboardingObject(result, self.client)

    def get(self, onboarding_id, **params):
        if not onboarding_id or not onboarding_id == "me":
            raise IdentifierError(f"Invalid onboarding ID: '{onboarding_id}'. The onboarding ID should be 'me'.")
        return super().get(onboarding_id, **params)

    def create(self, resource_id, data=None, **params):
        path = self.get_resource_name() + "/" + str(resource_id)

        result = self.perform_api_call(self.REST_CREATE, path, data, params)