@using BTCPayServer.Client
@using BTCPayServer.Views.Stores
@using Microsoft.AspNetCore.Mvc.TagHelpers
@model BTCPayServer.PayoutProcessors.Lightning.UILightningAutomatedPayoutProcessorsController.LightningTransferViewModel
@{
    ViewData["NavPartialName"] = "../UIStores/_Nav";
    Layout = "../Shared/_NavLayout.cshtml";
    ViewData.SetActivePage(StoreNavPages.PayoutProcessors, "Lightning Payout Processor", Context.GetStoreData().Id);
}
<div class="row">
    <div class="col-xl-8 col-xxl-constrain">
        <div class="d-flex align-items-center justify-content-between mb-3">
            <h3 class="mb-0">@ViewData["Title"]</h3>
        </div>
        <p>Set a schedule for automated Lightning Network Payouts.</p>
        @if (!ViewContext.ModelState.IsValid)
        {
            <div asp-validation-summary="All"></div>
        }
        <form method="post" permissioned="@Policies.CanModifyStoreSettings">
            <div class="d-flex my-3">
                <input asp-for="ProcessNewPayoutsInstantly" type="checkbox" class="btcpay-toggle me-3" />
                <label asp-for="ProcessNewPayoutsInstantly" class="form-check-label">Process approved payouts instantly</label>
                <span asp-validation-for="ProcessNewPayoutsInstantly" class="text-danger"></span>
            </div>
            <div class="form-group">
                <label asp-for="IntervalMinutes" class="form-label" data-required>Interval</label>
                <div class="input-group">
                    <input asp-for="IntervalMinutes" class="form-control" inputmode="numeric" style="max-width:12ch;">
                    <span class="input-group-text">minutes</span>
                    <span asp-validation-for="IntervalMinutes" class="text-danger"></span>
                </div>
            </div>
            <div class="form-group">
                <label asp-for="CancelPayoutAfterFailures" class="form-label">Max Payout Failure Attempts</label>
                <div class="input-group">
                    <input asp-for="CancelPayoutAfterFailures" min="1" class="form-control" inputmode="numeric" style="max-width:12ch;">
                    <span class="input-group-text">attempts</span>
                    <span asp-validation-for="IntervalMinutes" class="text-danger"></span>
                </div>
                <div class="form-text">If a payout fails this many times, it will be cancelled.</div>
            </div>
            
            <button name="command" type="submit" class="btn btn-primary mt-2" value="Save" id="Save">Save</button>
        </form>
    </div>
</div>

@section PageFootContent {
    <partial name="_ValidationScriptsPartial" />
}