@using IdentityServer8.Models
@model IEnumerable<IdentityServer8.EntityFramework.Entities.Client>

@{
    ViewData["Title"] = @SR["Index"];
}

<h2>@SR["Index"]</h2>

<p>
    <a asp-action="Create">@SR["Create New"]</a>
</p>

<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.ClientId)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Enabled)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.ClientName)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.FrontChannelLogoutUri)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.RedirectUris)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.AbsoluteRefreshTokenLifetime)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.AllowedGrantTypes)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.AccessTokenType)
        </th>
        <th></th>
    </tr>
    
@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.ClientId)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Enabled)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.ClientName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.FrontChannelLogoutUri)
        </td>
        <td>
            <ul>
            @foreach (var uri in item.RedirectUris)
                { <li>@uri.RedirectUri</li> }
            </ul>
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.AbsoluteRefreshTokenLifetime)
        </td>
        <td>
          <ul>
            @foreach (var t in item.AllowedGrantTypes)
                { <li>@t.GrantType</li> }
            </ul>
        </td>
        <td>
        @Enum.GetName(typeof(AccessTokenType), item.AccessTokenType)
        </td>
        <td>
            <a asp-action="Edit" asp-route-id="@item.ClientId">Edit</a> |
            <a asp-action="Details" asp-route-id="@item.ClientId">Details</a> |
            <a asp-action="Delete" asp-route-id="@item.ClientId">Delete</a>
        </td>
    </tr>
}
</table>
