<a href="<%= channel.relative_url %>">channel</a>
<% endpoint = data.model -%>
<a href="<%= channel.relative_url %>/webhook/inbound/endpoints">all endpoints</a>
<a href="<%= channel.relative_url %>/webhook/inbound/payloads?endpoint_id=<%= endpoint.id.not_nil!.to_b62 %>">payloads</a>

<h2>Endpoint: <%= endpoint.id.not_nil!.to_b62 %> (just created)</h2>

<table class="table">
  <tbody>
    <tr>
      <th>Client ID</th>
      <td class="text-monospace"><%= client_id = endpoint.uuid.to_base62 %></td>
    </tr>
    <tr>
      <th>secret</th>
      <td class="text-monospace"><%= secret = endpoint.secret %></td>
    </tr>
    <tr>
      <th>memo</th>
      <td class="text-monospace"><%= endpoint.bio %></td>
    </tr>
    <tr>
      <th>Created</th>
      <td>
        <%- if at = endpoint.created_at -%>
          <%-= component "timeago" -%>
        <%- else -%>
          unknown
        <%- end -%>
      </td>
    </tr>
    <tr>
      <th>Last Active</th>
      <td>
        never
      </td>
    </tr>
    <tr>
      <th>Active</th>
      <td>Yes</td>
    </tr>
    <tr>
      <th>Last Posted</th>
      <td>
        <%- if at = endpoint.lastposted_at -%>
          <%-= component "timeago" -%>
        <%- else -%>
          never
        <%- end -%>
      </td>
    </tr>
    <tr>
      <th>Next Post</th>
      <td>
        <%- if at = endpoint.nextpost_at -%>
          <%-= component "timeago" -%>
        <%- else -%>
          never
        <%- end -%>
      </td>
    </tr>
    <tr>
      <th>Default Body</th>
      <td class="text-monospace" style="white-space: pre;"><%-= endpoint.default_body.to_yaml.e %></td>
    </tr>
  </tbody>
</table>

<h2>Examples</h2>

<%-= component "channel/webhook/inbound/examples/curl" %>
<%-= component "channel/webhook/inbound/examples/crystal" %>
<%-= component "channel/webhook/inbound/examples/nodejs_axios" %>
<%-= component "channel/webhook/inbound/examples/ifttt" %>

<p>Tips:
<ul>
  <li>The POST body must be form URL encoded, JSON is not supported</li>
</ul>
<script>
if ( window.history.replaceState ) {
  window.history.replaceState( null, null, window.location.href+'/<%= endpoint.id.not_nil!.to_b62 %>/secret' );
}
</script>
