@using BTCPayServer.Plugins.SideShift
@inject SideShiftService SideShiftService
@model BTCPayServer.Models.InvoicingModels.CheckoutModel
@{
    const string id = "SideShift";
    var settings = await SideShiftService.GetSideShiftForInvoice(Model.InvoiceId, Model.StoreId);
    if (settings?.Enabled is true)
    {
        
        if (settings.ExplicitMethods?.Any() is true)
        {
            var coins = await SideShiftService.GetDepositOptions();
            foreach (var explicitMethod in settings.ExplicitMethods)
            {
                var s = explicitMethod.Split("_");
                var coin = s[0];
                var network = s[1];
                var coinInfo = coins.FirstOrDefault(c => c.CryptoCode == coin && c.Network == network);
                if(coinInfo is null)
                    continue;
                <a href="#ss_@coinInfo.Id" class="btcpay-pill m-0 payment-method" :class="{ active: pmId === '@id' && window.ssExplicitId === '@coinInfo.Id'}" v-on:click.prevent="()=>{ window.ssExplicitId = '@coinInfo.Id'; changePaymentMethod('@id'); }">
                    @coinInfo.DisplayName @(coinInfo.DisplayName.Equals(coinInfo.Network, StringComparison.InvariantCultureIgnoreCase)? string.Empty: $"({coinInfo.Network})")
                </a>
            }
        }
        if (!settings.OnlyShowExplicitMethods || settings.ExplicitMethods?.Any() is not true)
        {
             <a href="#@id" class="btcpay-pill m-0 payment-method" :class="{ active: pmId === '@id'  && !window.ssExplicitId  }" v-on:click.prevent="()=>{ window.ssExplicitId = null; changePaymentMethod('@id'); }">
                 @id
             </a>
        }
        
       
    }
}
