# 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/permission.py
# class Permission(ObjectBase):
#     @classmethod
#     def get_resource_class(cls, client):
#         from ..resources.permissions import Permissions
# 
#         return Permissions(client)
# 
#     @property
#     def id(self):
#         return self._get_property("id")
# 
#     @property
#     def resource(self):
#         return self._get_property("resource")
# 
#     @property
#     def description(self):
#         return self._get_property("description")
# 
#     @property
#     def granted(self):
#         return self._get_property("granted")
# 
# 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(",")


import re
from ..error import IdentifierError
from ..objects.permission import Permission
from .base import ResourceBase



class Permissions(ResourceBase):
    def get_resource_object(self, result):
        return Permission(result, self.client)

    @staticmethod
    def validate_permission_id(permission_id):
        if not permission_id or not bool(re.match(r"^[a-z]+\.[a-z]+$", permission_id)):
            raise IdentifierError(f"Invalid permission ID: '{permission_id}'. Does not match ^[a-z]+.[a-z]+$")


# 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/permission.py
# class Permission(ObjectBase):
#     @classmethod
#     def get_resource_class(cls, client):
#         from ..resources.permissions import Permissions
# 
#         return Permissions(client)
# 
#     @property
#     def id(self):
#         return self._get_property("id")
# 
#     @property
#     def resource(self):
#         return self._get_property("resource")
# 
#     @property
#     def description(self):
#         return self._get_property("description")
# 
#     @property
#     def granted(self):
#         return self._get_property("granted")
# 
# 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/permissions.py
import re
from ..error import IdentifierError
from ..objects.permission import Permission
from .base import ResourceBase




class Permissions(ResourceBase):
    def get_resource_object(self, result):
        return Permission(result, self.client)

    @staticmethod
    def validate_permission_id(permission_id):
        if not permission_id or not bool(re.match(r"^[a-z]+\.[a-z]+$", permission_id)):
            raise IdentifierError(f"Invalid permission ID: '{permission_id}'. Does not match ^[a-z]+.[a-z]+$")


    def get(self, permission_id, **params):