"""
Coaching Message Templates

Formatting templates for digest reports. Insight content is now
generated by the LLM -- these templates only handle layout.
"""


# Weekly digest template
WEEKLY_DIGEST_TEMPLATE = """
## Sparkey Reflect - Weekly Digest
**Period**: {period_start} to {period_end}
**Tool**: {tool}

### Overall Score: {overall_score}/100
{overall_assessment_section}
### Session Summary
- Sessions: {session_count}
- Total time: {total_duration:.0f} minutes
- Total tokens: {total_tokens:,}

### Scores by Category
{scores_section}

### Insights
{insights_section}

### Trends
{trends_section}
"""

# Daily digest template
DAILY_DIGEST_TEMPLATE = """
## Sparkey Reflect - Daily Digest
**Date**: {date}
**Tool**: {tool}

### Score: {overall_score}/100 | Sessions: {session_count} | Duration: {total_duration:.0f} min
{overall_assessment_section}
### Insights
{insights_section}
"""

# Learning path recommendation template
LEARNING_PATH_TEMPLATE = """
## Your Learning Path

Based on your scores, here are your priority areas:

{priority_areas}

### Recommended Next Steps
{next_steps}
"""

# Severity icons for text rendering
SEVERITY_ICONS = {
    "critical": "!!",
    "warning": "!",
    "suggestion": "*",
    "info": "-",
}


def format_insight_card(insight, index: int) -> str:
    """Format a single insight as a full-width text card."""
    icon = SEVERITY_ICONS.get(insight.severity.value, "-")
    severity_label = insight.severity.value.upper()

    lines = [
        f"  {icon} [{severity_label}] {insight.title}",
        f"    {insight.recommendation}",
    ]
    if insight.evidence:
        lines.append(f"    Evidence: {insight.evidence}")
    return "\n".join(lines)


REPORT_FOOTER = """
Thanks for using Sparkey Reflect! Get our Teams edition with Version Code + Project management integrations, trend tracking, usage analytics and industry benchmarks -> https://sparkey.ai
"""
