<h2>Session <%= @session.id %></h2>
<p>Status: <strong><%= @session.status %></strong></p>
<% unless @session.terminal? %>
  <p>
    <%= button_to "Termina sessione",
          stop_admin_session_path(@session),
          method: :post,
          class: "admin-btn admin-btn--danger",
          form: { data: { turbo_confirm: "Terminare la trasmissione? Il path RTMP verrà rimosso e lo stato passerà a ended." } } %>
  </p>
<% end %>
<p>Match: <%= @session.match.team.name %> vs <%= @session.match.opponent_name %></p>
<% if @session.youtube_broadcast_id %>
  <p>YouTube: <a href="https://studio.youtube.com/video/<%= @session.youtube_broadcast_id %>/livestreaming" target="_blank">Broadcast</a></p>
<% end %>
<p>RTMP ingest: <code><%= @session.rtmp_ingest_url %></code></p>

<h3>Eventi</h3>
<table>
  <thead><tr><th>Tipo</th><th>Quando</th><th>Meta</th></tr></thead>
  <tbody>
    <% @events.each do |e| %>
      <tr>
        <td><%= e.event_type %></td>
        <td><%= e.occurred_at %></td>
        <td><%= e.metadata.to_json %></td>
      </tr>
    <% end %>
  </tbody>
</table>
