{# Learn how to use Turbo Streams: https://github.com/symfony/ux-turbo#broadcast-doctrine-entities-update #}
{% block create %}
    <turbo-stream action="remove" target="active_monitors_no_monitors">
    </turbo-stream>

    <turbo-stream action="prepend" target="monitors">
        <template>
            <twig:MonitorListRow monitor="{{ entity }}" />
        </template>
    </turbo-stream>
{% endblock %}

{% block update %}
    <turbo-stream action="replace" target="monitor_{{ id }}">
        <template>
            <twig:MonitorListRow monitor="{{ entity }}" />
        </template>
    </turbo-stream>
{% endblock %}

{% block remove %}
    <turbo-stream action="remove" target="monitor_{{ id }}"></turbo-stream>

    <turbo-stream action="prepend" target="alert_list">
        <template>
            <twig:Alert title="Success" message="Your Monitor for '{{ entity.title }}' has been removed." alert_id="monitor_alert_{{ entity.id }}" data-controller="alert" />
        </template>
    </turbo-stream>
{% endblock %}
