mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 18:11:36 +01:00
40 lines
1.0 KiB
C#
40 lines
1.0 KiB
C#
using System;
|
|
|
|
namespace BTCPayServer.Rating
|
|
{
|
|
public enum RateSource
|
|
{
|
|
Coingecko,
|
|
Direct
|
|
}
|
|
public class AvailableRateProvider
|
|
{
|
|
public string Name { get; }
|
|
public string Url { get; }
|
|
public string Id { get; }
|
|
public string SourceId { get; }
|
|
public RateSource Source { get; }
|
|
|
|
public AvailableRateProvider(string id, string name, string url) : this(id, id, name, url, RateSource.Direct)
|
|
{
|
|
|
|
}
|
|
public AvailableRateProvider(string id, string sourceId, string name, string url, RateSource source)
|
|
{
|
|
Id = id;
|
|
SourceId = sourceId;
|
|
Name = name;
|
|
Url = url;
|
|
Source = source;
|
|
}
|
|
|
|
public string DisplayName =>
|
|
Source switch
|
|
{
|
|
RateSource.Direct => Name,
|
|
RateSource.Coingecko => $"{Name} (via CoinGecko)",
|
|
_ => throw new NotSupportedException(Source.ToString())
|
|
};
|
|
}
|
|
}
|