@using BTCPayServer.Plugins.Wabisabi
@using BTCPayServer.Abstractions.Contracts
@model WabisabiStoreController.SpendViewModel 
@inject IScopeProvider _scopeProvider
@inject WalletProvider WalletProvider
@{
    var storeId = _scopeProvider.GetCurrentStoreId();
    ViewData.SetActivePage("Plugins", "BTCPayServer.Views.Stores.StoreNavPages", "Spend", storeId);
    var wallet = (BTCPayWallet) await WalletProvider.GetWalletAsync(storeId);
    var coins = await wallet.GetAllCoins();
}
<form method="post">
    <div class="form-group">

        <label asp-for="Destination" class="form-check-label">BIP21 or address</label>
        <input type="text" class="form-control" asp-for="Destination">

        <span asp-validation-for="Destination" class="text-danger"></span>
    </div>
    <div class="form-group">

        <label asp-for="Amount" class="form-check-label">Amount</label>
        <input type="number" class="form-control" asp-for="Amount">

        <span asp-validation-for="Amount" class="text-danger"></span>
    </div>
    <div class="form-group mt-4">
        <label asp-for="SelectedCoins" class="form-label"></label>
        <select multiple="multiple" asp-for="SelectedCoins" class="form-select">
            @foreach (var coin in coins)
            {
                <option value="@coin.Outpoint.ToString()" class="text-truncate" asp-selected="@(Model.SelectedCoins?.Contains(coin.Outpoint.ToString()))">(@coin.Amount) @coin.Outpoint</option>
            }
        </select>
    </div>
    
<button name="command" type="submit" value="compute" class="btn btn-primary mt-2">Compute coin selection</button>
<button name="command" type="submit" value="compute-with-selection" class="btn btn-primary mt-2">Compute coin selection using only already selected coins</button>
<button name="command" type="submit" value="payout" class="btn btn-primary mt-2">Batch in join</button>
<button name="command" type="submit" value="send" class="btn btn-primary mt-2">Send</button>
</form>

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

<script type="text/javascript" >

 document.addEventListener("DOMContentLoaded", function () {
        });
 

</script>
