from __future__ import annotations

from store_schedule_lib.config_loader import load_reminder_rules


def format_message(kind: str, **kwargs) -> str:
    rules = load_reminder_rules()
    templates = rules.get("messages", {})
    template = templates.get(kind, "{title}")
    try:
        return template.format(**kwargs)
    except KeyError:
        return template
