<html>
    <head>
        <title>GA4GH reference server {{ info.getServerVersion()}}</title>
        <link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
        <link rel=stylesheet type=text/css href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
        <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    </head>
    <body><div class="container">
        <h2>GA4GH reference server {{ info.getServerVersion() }}</h2>
        <div>
            <h3>Protocol version {{ info.getProtocolVersion() }}</h3>
        </div>
        <div>
            <h3>Session Token {{ session['key']}}</h3>
        </div>
        <div>
            <h3>Operations available</h3>
            <table class="table table-striped">
                <th>Method</th>
                <th>Path</th>
                {% for url in info.getUrls() %}
                <tr>
                    <td>{{ url[0] }}</td>
                    <td>{{ url[1] }}</td>
                </tr>
                {% endfor %}
            </table>
        </div>
        <div>
            <h3>Uptime</h3>
            Running since {{ info.getNaturalUptime()}} ({{ info.getPreciseUptime()}})
        </div>
        <div>
            <h3>Configuration</h3>
            <table class="table table-striped">
                <th>Key</th>
                <th>Value</th>
                {% for key, value in info.getConfiguration() %}
                <tr>
                    <td>{{ key }}</td>
                    <td>{{ value }}</td>
                </tr>
                {% endfor %}
            </table>
        </div>
        <div>
            <h3>Data</h3>

            <h4>ReferenceSets</h4>
            <table class="table table-striped">
                <th>Name</th>
                <th>Id</th>
                <th>Reference Name</th>
                <th>Reference Id</th>
                {% for referenceSet in info.getReferenceSets() %}
                <tr>
                    <td>{{ referenceSet.getLocalId() }}</td>
                    <td>{{ referenceSet.getId() }}</td>
                    <td></td>
                    <td></td>
                </tr>
                {% for reference in referenceSet.getReferences() %}
                <tr>
                    <td></td>
                    <td></td>
                    <td>{{ reference.getLocalId() }}</td>
                    <td>{{ reference.getId() }}</td>
                </tr>
                {% endfor %}
                {% endfor %}
            </table>

            {% for dataset in info.getDatasets() %}
            <h4>Dataset name: {{ dataset.getLocalId() }} id: {{ dataset.getId() }}</h4>
                <h6>VariantSets</h6>
                <table class="table table-striped">
                    <th>Name</th>
                    <th>Id</th>
                    {% for variantSet in info.getVariantSets(dataset.getId()) %}
                    <tr>
                        <td>{{ variantSet.getLocalId() }}</td>
                        <td>{{ variantSet.getId() }}</td>
                    </tr>
                    {% endfor %}
                </table>
                <h6>ReadGroupSets</h6>
                <table class="table table-striped">
                    <th>Name</th>
                    <th>Id</th>
                    <th>ReadGroup Name</th>
                    <th>ReadGroup Id</th>
                    {% for readGroupSet in info.getReadGroupSets(dataset.getId())%}
                    <tr>
                        <td>{{ readGroupSet.getLocalId() }}</td>
                        <td>{{ readGroupSet.getId() }}</td>
                        <td></td>
                        <td></td>
                    </tr>
                    {% for readGroup in readGroupSet.getReadGroups() %}
                    <tr>
                        <td></td>
                        <td></td>
                        <td>{{ readGroup.getLocalId() }}</td>
                        <td>{{ readGroup.getId() }}</td>
                    </tr>
                    {% endfor %}
                    {% endfor %}
                </table>
            {% endfor %}
        </div>
    </div></body>
</html>
