@page "{runId}"
@model QuantEngine.Web.Pages.Admin.Collection.ErrorsModel
@{
    ViewData["Title"] = "수집 오류 - " + Model.RunId;
}

<div class="page-header d-print-none">
    <div class="row align-items-center">
        <div class="col">
            <h2 class="page-title">수집 오류: @Model.RunId</h2>
        </div>
        <div class="col-auto">
            <a href="/Admin/Collection" class="btn btn-secondary">목록으로</a>
        </div>
    </div>
</div>

<div class="page-body">
    <div class="card">
        <div class="card-header">
            <h3 class="card-title">오류 목록 (@Model.Errors?.Count ?? 0)</h3>
        </div>
        <div class="table-responsive">
            <table class="table table-vcenter card-table">
                <thead>
                    <tr>
                        <th>소스명</th>
                        <th>오류 종류</th>
                        <th>메시지</th>
                        <th>발생 시간</th>
                    </tr>
                </thead>
                <tbody>
                    @if (Model.Errors?.Any() == true)
                    {
                        @foreach (var error in Model.Errors)
                        {
                            <tr>
                                <td>@error.SourceName</td>
                                <td><span class="badge bg-danger">@error.ErrorKind</span></td>
                                <td class="text-muted">@(error.ErrorMessage ?? "-")</td>
                                <td>@error.CreatedAt</td>
                            </tr>
                        }
                    }
                    else
                    {
                        <tr>
                            <td colspan="4" class="text-center text-muted">오류가 없습니다</td>
                        </tr>
                    }
                </tbody>
            </table>
        </div>
    </div>
</div>
