namespace Managing.Domain.Synth.Models;

/// <summary>
/// Represents a cached leaderboard entry for Synth miners
/// Used for MongoDB persistence to avoid repeated API calls
/// </summary>
public class SynthMinersLeaderboard
{
    /// <summary>
    /// Unique identifier for this leaderboard entry
    /// </summary>
    public string Id { get; set; }
    
    /// <summary>
    /// Asset symbol (e.g., "BTC", "ETH")
    /// </summary>
    public string Asset { get; set; }
    
    /// <summary>
    /// Time increment used for this leaderboard data
    /// </summary>
    public int TimeIncrement { get; set; }
    
    /// <summary>
    /// Signal date for which this leaderboard was retrieved (for backtests)
    /// Null for live trading data
    /// </summary>
    public DateTime? SignalDate { get; set; }
    
    /// <summary>
    /// Whether this is backtest data or live data
    /// </summary>
    public bool IsBacktest { get; set; }
    
    /// <summary>
    /// List of miners in the leaderboard
    /// </summary>
    public List<MinerInfo> Miners { get; set; } = new();
    
    /// <summary>
    /// When this leaderboard data was created/stored
    /// </summary>
    public DateTime CreatedAt { get; set; }
    
    /// <summary>
    /// Generates a cache key for this leaderboard entry
    /// </summary>
    public string GetCacheKey()
    {
        var key = $"{Asset}_{TimeIncrement}";
        if (IsBacktest && SignalDate.HasValue)
        {
            key += $"_backtest_{SignalDate.Value:yyyy-MM-dd-HH}";
        }
        return key;
    }
} 