<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>immuneML: Clustering overview</title>
    <style>
        {{{css_style}}}
        .figures-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 2em;
        }
        @media (max-width: 1200px) {
            .figures-grid {
                grid-template-columns: 1fr;
            }
        }
    </style>
    <meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
    <div class="container">
        <div>
            <h1>Clustering workflow: {{name}}</h1>
            <p>immuneML version: {{immuneML_version}}</p>
            <p>Full specification is available <a href="{{{full_specs}}}">here</a>.</p>
            <p>Log file is available <a href="{{{logfile}}}">here</a>.</p>

            <div class="dataset-info">
                <table>
                    <tr>
                        <td>Name</td>
                        <td>{{dataset_name}}</td>
                    </tr>
                    <tr>
                        <td>Type</td>
                        <td>{{dataset_type}}</td>
                    </tr>
                    <tr>
                        <td>Dataset size</td>
                        <td>{{dataset_size}}</td>
                    </tr>
                </table>
            </div>

            {{#clustering_reports.has_reports}}
            <h2>Clustering Analysis Reports</h2>
            {{#clustering_reports.reports}}
            <details>
                <summary>{{ name }}</summary>
                <div class="report-section">
                    {{#info}}<p>{{info}}</p>{{/info}}

                    <div class="figures-grid">
                        {{#output_figures}}
                        <div class="figure-container">
                            <h4>{{name}}</h4>
                            {{#is_embed}}
                            <iframe src="{{path}}" width="100%" height="600px"></iframe>
                            {{/is_embed}}
                            {{^is_embed}}
                            <img src="{{path}}" alt="{{name}}">
                            {{/is_embed}}
                        </div>
                        {{/output_figures}}
                    </div>

                    {{#output_tables}}
                    <div class="table-section">
                        <h4>{{name}}</h4>
                        <a href="{{download_link}}" download>Download {{file_name}}</a>
                        <div class="table-container">
                            {{{table}}}
                        </div>
                    </div>
                    {{/output_tables}}

                    {{#output_text}}
                    <div class="text-section">
                        <h4>{{name}}</h4>
                        <pre class="text-output">{{path}}</pre>
                    </div>
                    {{/output_text}}
                </div>
            </details>
            {{/clustering_reports.reports}}
            {{/clustering_reports.has_reports}}

            <h2>Results by Split</h2>
            <p>Splitting into multiple discovery and validation set pairs allows for stability analysis of
                the clustering settings. Click on a split below to view detailed results:</p>
            
            <ul class="setting-links">
                {{#splits}}
                <li><a href="{{path}}">Split {{number}}</a></li>
                {{/splits}}
            </ul>
        </div>
    </div>
</body>
</html>