@model SceneMovePreviewViewModel
@{
    ViewData["Title"] = "Move Scene Preview";
}

<div class="page-heading compact">
    <div>
        <p class="eyebrow">Move scene</p>
        <h1>@Model.Preview.SceneTitle</h1>
    </div>
</div>

<section class="edit-panel move-preview-panel">
    <h2>Preview</h2>
    <div class="row g-3">
        <div class="col-md-6">
            <p class="eyebrow">Current position</p>
            <p><strong>@Model.Preview.SourceBookTitle</strong></p>
            <p>Chapter @Model.Preview.SourceChapterNumber: @Model.Preview.SourceChapterTitle</p>
            <p>Scene @Model.Preview.SceneNumber: @Model.Preview.SceneTitle</p>
        </div>
        <div class="col-md-6">
            <p class="eyebrow">Proposed position</p>
            <p><strong>@Model.Preview.TargetBookTitle</strong></p>
            <p>Chapter @Model.Preview.TargetChapterNumber: @Model.Preview.TargetChapterTitle</p>
            <p>Position: @Model.Preview.Position.ToLowerInvariant()</p>
        </div>
    </div>

    <div class="focused-validation-summary">
        <span>@Model.Preview.DependencyCount dependenc@(Model.Preview.DependencyCount == 1 ? "y" : "ies") attached</span>
        <span>@Model.Preview.ActiveWarningCount active warning@(Model.Preview.ActiveWarningCount == 1 ? "" : "s") on this scene</span>
        <span>After confirming, PlotWeaver Studio will run validation for the target book.</span>
    </div>

    @if (Model.CurrentWarnings.Any())
    {
        <div class="warning-mini-list mt-3">
            @foreach (var warning in Model.CurrentWarnings.Take(5))
            {
                <div class="warning-mini-card">
                    <span class="severity-pill @warning.SeverityName.ToLowerInvariant()">@warning.SeverityName</span>
                    <strong>@warning.WarningTypeName</strong>
                    <p>@warning.Message</p>
                </div>
            }
        </div>
    }

    <div class="button-row mt-3">
        <form asp-action="ConfirmMove" method="post">
            <input type="hidden" name="SceneID" value="@Model.Request.SceneID" />
            <input type="hidden" name="TargetChapterID" value="@Model.Request.TargetChapterID" />
            <input type="hidden" name="Position" value="@Model.Request.Position" />
            <input type="hidden" name="RenumberScenes" value="@Model.Request.RenumberScenes.ToString().ToLowerInvariant()" />
            <input type="hidden" name="ReturnProjectID" value="@Model.Request.ReturnProjectID" />
            <input type="hidden" name="ReturnBookID" value="@Model.Request.ReturnBookID" />
            <button class="btn btn-primary" type="submit">Confirm move</button>
        </form>
        <a class="btn btn-outline-secondary"
           asp-controller="Timeline"
           asp-action="Index"
           asp-route-projectId="@Model.Request.ReturnProjectID"
           asp-route-bookId="@Model.Request.ReturnBookID"
           asp-route-selectedSceneId="@Model.Request.SceneID">Cancel</a>
    </div>
</section>
