{% extends "base.html" %}
{% block fullbody %}

<div class="ui stackable mobile reversed grid centered">
<div class="one wide column"></div>
<div class="fifteen wide column">
  <h1 class="ui header">
  <div class="sub header"><code>file {{ file.ident }}</code></div></h1>
</div>
</div>

<div class="ui stackable mobile reversed grid centered">
<div class="one wide column"></div>
<div class="ten wide column" style="font-size: 16px;">

{% if file.extra != None %}
<h3>Extra Metadata (raw JSON)</h3>
{% for (key, value) in file.extra.items() %}
<code><b>{{ key }}:</b> {{ value }}</code><br>
{% endfor %}
{% endif %}

<h3>Releases</h3>
{% if file.release_ids != None %}
<p>Releases associated with this file:
<ul>
{% for release_id in file.release_ids %}
  <li><a href="/release/{{ release_id }}"><code>{{ release_id }}</code></a>
{% endfor %}
</ul>
{% else %}
This file is not associated with any fatcat release.
{% endif %}

<h3>URLs</h3>
{% if file.url != None %}
<p>Known locations of this file:
<ul>
{% for url in file.urls %}
  <li><a href="{{ url.url }}">{{ url.url.split('/')[2] }}</a> ({{ url.rel }})<br>
{% endfor %}
</ul>
{% else %}
No known public URL, mirror, or archive for this file.
{% endif %}

<h3>Checksums</h3>
<table class="ui compact table">
  <thead>
    <tr><th>Algorithm
        <th>Value
  <tbody>
    {% if file.sha1 != None %}
    <tr><td>SHA-1
        <td><small><code>{{ file.sha1 }}</code></small>
    {% endif %}
    {% if file.sha256 != None %}
    <tr><td>SHA-256
        <td><small><code>{{ file.sha256 }}</code></small>
    {% endif %}
    {% if file.md5!= None %}
    <tr><td>MD5
        <td><small><code>{{ file.md5 }}</code></small>
    {% endif %}
</table>

<!--
Raw Object:
{{ file|safe }}
-->

</div>
<div class="five wide column">

{% if file.urls != None and file.urls != [] %}
<a href="https://web.archive.org/web/1/{{ file.urls[0].url }}" class="ui top attached fluid huge green button"><i class="file icon"></i>Download File</a>
{% else %}
<span class="ui top attached fluid huge grey button"><i class="file cross icon"></i>No Download Available</span>
{% endif %}

<div class="ui segment attached">

{% if file.size != None %}
<p><b>Size</b> &nbsp;{{ file.size }} (bytes)
</div><div class="ui segment attached">
{% endif %}

{% if file.mimetype != None %}
<p><b>File Type</b> &nbsp;<code>{{ file.mimetype }}</code>
</div><div class="ui segment attached">
{% endif %}

<b>Fatcat Bits</b>
<p>State is "{{ file.state }}". Revision:
<br><small><code>{{ file.revision }}</code></small>
<br><a href="https://api.{{ config.FATCAT_DOMAIN }}/v0/file/{{ file.ident }}">As JSON object via API</a>

</div>
<div class="two ui buttons bottom attached">
  <a href="/file/{{ file.ident }}/edit" class="ui blue button">Edit Metadata</a>
  <a href="/file/{{ file.ident }}/history" class="ui button">View History</a>
</div>

</div>
</div>


{% endblock %}