@using BTCPayServer.Abstractions.Extensions
@using Microsoft.AspNetCore.Mvc.TagHelpers
@model BTCPayServer.Plugins.DataErasure.DataErasureSettings
@{
    ViewData.SetActivePage("DataErasure", "Data Erasure", "DataErasure");
}

<form method="post">

    <div class="sticky-header-setup"></div>
    <div class="sticky-header d-sm-flex align-items-center justify-content-between">
        <h2 class="mb-0">@ViewData["Title"]</h2>
        <div class="d-flex gap-3 mt-3 mt-sm-0">

            <button name="command" type="submit" value="save" class="btn btn-primary">Submit</button>
        </div>
    </div>


    <partial name="_StatusMessage"/>
    <div class="alert alert-warning">
        <p>
            This plugin erases buyer information on your store's invoices based on when they were created. THERE IS NO UNDOING THIS ACTION ONCE IT HAS EXECUTED.
        </p>
    </div>
    <div class="row">
        <div class="col-xl-8 col-xxl-constrain">
            <div class="form-group">
                <div class="d-flex align-items-center">
                    <input asp-for="Enabled" type="checkbox" class="btcpay-toggle me-2"/>
                    <label asp-for="Enabled" class="form-label mb-0 me-1"></label>
                </div>
            </div>
            <div class="form-group">
                <label asp-for="DaysToKeep" class="form-label">Days to keep data</label>
                <input asp-for="DaysToKeep" type="number" class="form-control"/>

            </div>
            <div class="form-group">
                <div class="d-flex align-items-center">
                    <input asp-for="EntirelyEraseInvoice" type="checkbox" class="btcpay-toggle me-2"/>
                    <label asp-for="EntirelyEraseInvoice" class="form-label mb-0 me-1">Remove entire invoice from records (instead of just buyer data)</label>
                 
                </div>
                <div class="alert alert-warning">
                    <p>
                        Deleting entire invoices may cause issues with integrations and accounting. Only use this option if you are sure you want to remove the invoice entirely.
                    </p>
                </div>
            </div>
            @if (Model.LastRunCutoff != null)
            {
                <div>Cleared data up to @Model.LastRunCutoff.Value.ToString("g")</div>
                <div class="form-group">
                    <button name="command" type="submit" value="cleardate" class="btn btn-danger">Start over</button>
                </div>
            }

        </div>
    </div>
</form>