@model SharedKernel.Helpers.Pagination
@if (Model is not null && Model.TotalRows > 0)
{
<nav id="pagination" aria-label="Page navigation">
    <ul class="pagination justify-content-center">

        @if (Model.HasPreviousPage)
        {
            <li class="page-item">
                <a class="page-link" href="?pageNum=@Model.PrevGroupPage&perPage=@Model.PerPage@Model.BuildQueryString()">이전</a>
            </li>
        }
        else
        {
            <li class="page-item disabled">
                <span class="page-link">이전</span>
            </li>
        }

        <!-- 페이지 번호 표시 -->
        @for (int i = Model.StartPage; i <= Model.EndPage; i++)
        {
            if (i == Model.Page)
            {
                <li class="page-item active">
                    <span class="page-link">@i</span>
                </li>
            }
            else
            {
                <li class="page-item">
                    <a class="page-link" href="?pageNum=@i&perPage=@Model.PerPage@Model.BuildQueryString()">@i</a>
                </li>
            }
        }

        @if (Model.HasNextPage && Model.NextGroupPage <= Model.TotalPage)
        {
            <li class="page-item">
                    <a class="page-link" href="?pageNum=@Model.NextGroupPage&perPage=@Model.PerPage@Model.BuildQueryString()">다음</a>
            </li>
        }
        else
        {
            <li class="page-item disabled">
                <span class="page-link">다음</span>
            </li>
        }
    </ul>
</nav>
}