@model FeatureRequestDetailsViewModel

@if (!Model.Messages.Any())
{
    <p class="muted">No replies yet.</p>
}
else
{
    <div class="d-flex flex-column gap-3">
        @foreach (var message in Model.Messages)
        {
            <article class="border rounded p-3">
                <div class="d-flex justify-content-between gap-3 flex-wrap mb-2">
                    <strong>@(message.IsAdmin ? "PlotDirector team" : message.UserDisplayName ?? "You")</strong>
                    <span class="muted">@FormatDate(message.CreatedUtc)</span>
                </div>
                <p class="mb-0" style="white-space: pre-wrap">@message.MessageBody</p>
            </article>
        }
    </div>
}

@functions {
    private static string FormatDate(DateTime value) => value.ToLocalTime().ToString("yyyy-MM-dd HH:mm");
}
