import importlib_metadata
from flask_resources import ResponseHandler

{{ vars.json_serializer.class|imports }}
{{ vars.resource_config|imports }}

class {{ vars.resource_config|class_header }}:
    """{{ vars.record.class|base_name }} resource config."""

    blueprint_name = '{{ vars.api_blueprint.alias }}'
    url_prefix = '{{ vars.resource_config.base_url }}'

    @property
    def response_handlers(self):
        entrypoint_response_handlers = {}
        for x in importlib_metadata.entry_points(group='invenio.{{ vars.module.qualified }}.response_handlers'):
            entrypoint_response_handlers.update(x.load())
        return {
            "application/vnd.inveniordm.v1+json": ResponseHandler({{vars.json_serializer.class|base_name}}()),
            **super().response_handlers,
            **entrypoint_response_handlers
        }

{{ vars.resource_config|extra_code }}