@model TightWiki.Models.ViewModels.Utility.ConfirmActionViewModel
@{
    Layout = "/Views/Shared/_Layout.cshtml";
    var sessionState = ViewData["SessionState"] as TightWiki.SessionState ?? throw new Exception("Wiki State Context cannot be null.");

    string cardClass = "card mb-3";
    string cardHeaderClass = "card-header";

    if (string.Equals(Model.Style, "Danger", StringComparison.InvariantCultureIgnoreCase))
    {
        cardHeaderClass += " bg-danger text-white";
        cardClass += " border-danger";
    }
    if (string.Equals(Model.Style, "Warn", StringComparison.InvariantCultureIgnoreCase))
    {
        cardHeaderClass += " bg-warning";
        cardClass += " border-warning";
    }
}

@if (!string.IsNullOrEmpty(Model.ErrorMessage))
{
    <div class="alert alert-danger">@Html.Raw(Model.ErrorMessage)</div>
}
@if (!string.IsNullOrEmpty(Model.SuccessMessage))
{
    <div class="alert alert-success">@Html.Raw(Model.SuccessMessage)</div>
}

<div class="@cardClass">
    <div class="@cardHeaderClass">
        <strong>Are you sure???</strong>
    </div>
    <div class="card-body">

        @Html.Raw(@Model.Message)<br /><br />

        <form action='@Model.ControllerURL' method="post">
            @Html.HiddenFor(m => m.NoRedirectURL)
            @Html.HiddenFor(m => m.YesRedirectURL)
            @Html.HiddenFor(m => m.Message)
            @Html.HiddenFor(m => m.Style)

            @if (Model.Style == "Safe")
            {
                <div class="form-group"><button type="submit" class="btn btn-success rounded-0" name="UserSelection" value="true">是</button>&nbsp;&nbsp;<button type="submit" class="btn btn-success rounded-0" name="UserSelection" value="false">否</button></div>
            }
            else if (Model.Style == "Warn")
            {
                <div class="form-group"><button type="submit" class="btn btn-warning rounded-0" name="UserSelection" value="true">是</button>&nbsp;&nbsp;<button type="submit" class="btn btn-success rounded-0" name="UserSelection" value="false">否</button></div>
            }
            else
            {
                <div class="form-group"><button type="submit" class="btn btn-danger rounded-0" name="UserSelection" value="true">是</button>&nbsp;&nbsp;<button type="submit" class="btn btn-success rounded-0" name="UserSelection" value="false">否</button></div>
            }
        </form>
    </div>
</div>

