{% load hc_extras humanize linemode %}{% linemode %}
{% if status == "down" %}
    {% line %}🔴 The check <a href="{{ check.cloaked_url }}">{{ check.name_then_code }}</a> is <b>DOWN</b>{% if flip.reason %} ({{ flip.reason_long }}){% endif %}.{% endline %}
{% else %}
    {% line %}🟢 The check <a href="{{ check.cloaked_url }}">{{ check.name_then_code }}</a> is now <b>UP</b>.{% endline %}
{% endif %}
{% line %}{% endline %}

{% if check.project.name %}
{% line %}<b>Project:</b> {{ check.project.name }}{% endline %}
{% endif %}

{% if check.tags_list %}
{% line %}<b>Tags:</b> {{ check.tags_list|join:", " }}{% endline %}
{% endif %}

{% if check.kind == "simple" %}
{% line %}<b>Period:</b> {{ check.timeout|hc_duration }}{% endline %}
{% endif %}

{% if check.kind == "cron" or check.kind == "oncalendar" %}
{% line %}<b>Schedule:</b> <code>{{ check.schedule }}</code>{% endline %}
{% line %}<b>Time Zone:</b> {{ check.tz }}{% endline %}
{% endif %}

{% line %}<b>Total Pings:</b> {% if ping %}{{ ping.n }}{% else %}0{% endif %}{% endline %}

{% if ping is None %}
{% line %}<b>Last Ping:</b> Never{% endline %}
{% else %}
{% line %}<b>Last Ping:</b> {{ ping.get_kind_display }}, {{ ping.created|naturaltime }}{% endline %}
{% endif %}

{% if body %}
{% line %}<b>Last Ping Body:</b>{% endline %}
{% line %}<pre>{{ body }}</pre>{% endline %}
{% endif %}

{% if down_checks is not None %}
    {% line %}{% endline %}
    {% if down_checks %}
        {% if down_checks|length > 10 %}
            {% line %}{{ down_checks|length }} other checks are {% if status == "down" %}also{% else %}still{% endif %} down.{% endline %}
        {% else %}
            {% line %}The following checks are {% if status == "down" %}also{% else %}still{% endif %} down:{% endline %}
            {% for c in down_checks %}
                {% line %}- <a href="{{ c.cloaked_url }}">{{ c.name_then_code }}</a> (last ping: {{ c.last_ping|naturaltime|default:"never" }}){% endline %}
            {% endfor %}
        {% endif %}
    {% else %}
        {% line %}All the other checks are up.{% endline %}
    {% endif %}
{% endif %}
{% endlinemode %}