"""Bundled dashboard: reminders."""
import json


def register(ctx):
    from dashboard_bundled.feeds import feed_reminders

    ctx.register_dashboard_tile(
        {
            "id": "reminders",
            "title": "Reminders",
            "path": "/tile",
            "refresh_seconds": 600,
            "priority": 3,
        }
    )

    def route_handler(req):
        body = json.dumps(feed_reminders(), ensure_ascii=False)
        return {
            "status": 200,
            "headers": {"Content-Type": "application/json; charset=utf-8"},
            "body": body,
        }

    ctx.register_route_handler(route_handler)
