@using SharedLibraryCore.Dtos.Meta.Responses
@model IEnumerable<MessageResponse>

@foreach (var message in Model)
{
    <!-- desktop -->
    <tr class="d-none d-lg-table-row">
        <td colspan="20%" class="text-break">
            <a asp-controller="Client" asp-action="Profile" asp-route-id="@message.ClientId" class="link-inverse">
                <color-code value="@message.ClientName"></color-code>
            </a>
        </td>
        <td colspan="45%" class="text-break">
            @if (message.IsHidden && !ViewBag.Authorized)
            {
                <color-code value="@Utilities.FormatExt(ViewBag.Localization["WEBFRONT_CLIENT_META_CHAT_HIDDEN"], message.HiddenMessage)"></color-code>
            }
            else
            {
                <color-code value="@message.Message"></color-code>
            }
        </td>
        <td colspan="20%" class="text-break">
            <color-code value="@(message.ServerName ?? "--")"></color-code>
        </td>
        <td colspan="15%" class="text-right text-break">
            @message.When.ToStandardFormat()
        </td>
    </tr>

    <!-- mobile -->
    <tr class="d-flex d-lg-none">
        <td class="bg-primary text-light">
            <div>@ViewBag.Localization["WEBFRONT_PENALTY_TEMPLATE_ADMIN"]</div>
            <div>@ViewBag.Localization["WEBFRONT_ACTION_LABEL_MESSAGE"]</div>
            <div>@ViewBag.Localization["WEBFRONT_STATS_MESSAGE_SERVER_NAME"]</div>
            <div>@ViewBag.Localization["WEBFRONT_ADMIN_AUDIT_LOG_TIME"]</div>
        </td>
        <td class="flex-fill">
            <a asp-controller="Client" asp-action="Profile" asp-route-id="@message.ClientId">
                <color-code value="@message.ClientName"></color-code>
            </a>
            <div>
                @if (message.IsHidden && !ViewBag.Authorized)
                {
                    <color-code value="@Utilities.FormatExt(ViewBag.Localization["WEBFRONT_CLIENT_META_CHAT_HIDDEN"], message.HiddenMessage)"></color-code>
                }
                else
                {
                    <color-code value="@message.Message"></color-code>
                }
            </div>
            <div>
                <color-code value="@(message.ServerName ?? "--")"></color-code>
            </div>
            <div>@message.When.ToStandardFormat()</div>
        </td>
    </tr>
}
