@using SharedLibraryCore.Dtos.Meta.Responses
@model ReceivedPenaltyResponse

@{
    var localizationKey = $"WEBFRONT_CLIENT_META_WAS_PENALIZED_{Model.PenaltyType.ToString().ToUpper()}_V2";
}

<has-permission entity="ClientLevel" required-permission="Read">
    @if (TempData["ShowMetaHeader"] as bool? ?? false)
    {
        <partial name="./_MetaHeader.cshtml" for="@Model.When"/>
    }

    <div class="d-inline">
        @foreach (var match in Utilities.SplitTranslationTokens(localizationKey))
        {
            if (match.IsInterpolation)
            {
                if (match.MatchValue == "action")
                {
                    <span class="penalties-color-@Model.PenaltyType.ToString().ToLower()">@match.TranslationValue</span>
                }

                else if (match.MatchValue == "punisher")
                {
                    <span class="text-highlight">
                        <a asp-action="Profile" asp-controller="Client" asp-route-id="@Model.PunisherClientId">
                            <color-code value="@Model.PunisherName"></color-code>
                        </a>
                    </span>
                }

                else if (match.MatchValue == "reason")
                {
                    <span class="text-white-dm text-black-lm">
                        @if (ViewBag.Authorized && !string.IsNullOrEmpty(Model.AutomatedOffense) && Model.PenaltyType != Data.Models.EFPenalty.PenaltyType.Warning && Model.PenaltyType != Data.Models.EFPenalty.PenaltyType.Kick)
                        {
                            <span>@Utilities.FormatExt(ViewBag.Localization["WEBFRONT_PROFILE_ANTICHEAT_DETECTION"], Model.AutomatedOffense)</span>
                            <span class="oi oi-list-rich align-top text-primary automated-penalty-info-detailed" data-penalty-id="@Model.PenaltyId" style="margin-top: 0.125rem;" title="@ViewBag.Localization["WEBFRONT_CLIENT_META_AC_METRIC"]"></span>
                        }
                        else
                        {
                            <color-code value="@Model.Offense"></color-code>
                        }

                    </span>
                }

                else if (match.MatchValue == "time")
                {
                    <span class="text-light-dm text-dark-lm">@Model.LengthText</span>
                }
            }

            else
            {
                <span>@match.MatchValue</span>
            }
        }

        @if (Model.ClientId != Model.OffenderClientId)
        {
            <span>&mdash;</span>
            @foreach (var helperResult in Utilities.SplitTranslationTokens("WEBFRONT_PROFILE_LINKED_ACCOUNT"))
            {
                if (!helperResult.IsInterpolation)
                {
                    <span>@helperResult.MatchValue</span>
                }

                else
                {
                    <a class="link-inverse" href="@Model.OffenderClientId">
                        <color-code value="@Model.OffenderName"></color-code>
                    </a>
                }
            }
        }
    </div>
</has-permission>
