namespace Managing.Domain.Synth.Models;

/// <summary>
/// Represents cached prediction data from Synth miners
/// Used for MongoDB persistence to avoid repeated API calls
/// </summary>
public class SynthMinersPredictions
{
    /// <summary>
    /// Unique identifier for this predictions 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 these predictions
    /// </summary>
    public int TimeIncrement { get; set; }
    
    /// <summary>
    /// Time length (horizon) for these predictions in seconds
    /// </summary>
    public int TimeLength { get; set; }
    
    /// <summary>
    /// Signal date for which these predictions were 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 miner UIDs these predictions are from
    /// </summary>
    public List<int> MinerUids { get; set; } = new();
    
    /// <summary>
    /// The actual prediction data from miners
    /// </summary>
    public List<MinerPrediction> Predictions { get; set; } = new();
    
    /// <summary>
    /// When this prediction data was fetched from the API
    /// </summary>
    public DateTime FetchedAt { get; set; }
    
    /// <summary>
    /// When this prediction data was created/stored
    /// </summary>
    public DateTime CreatedAt { get; set; }
    
    /// <summary>
    /// Generates a cache key for this predictions entry
    /// </summary>
    public string GetCacheKey()
    {
        var key = $"{Asset}_{TimeIncrement}_{TimeLength}";
        if (IsBacktest && SignalDate.HasValue)
        {
            key += $"_backtest_{SignalDate.Value:yyyy-MM-dd-HH}";
        }
        return key;
    }
} 