namespace Managing.Domain.Synth.Models;

/// <summary>
/// Represents cached prediction data from a single Synth miner
/// Used for MongoDB persistence to avoid repeated API calls and reduce document size
/// </summary>
public class SynthPrediction
{
    /// <summary>
    /// Unique identifier for this prediction entry
    /// </summary>
    public string Id { get; set; }
    
    /// <summary>
    /// Asset symbol (e.g., "BTC", "ETH")
    /// </summary>
    public string Asset { get; set; }
    
    /// <summary>
    /// Miner UID that provided this prediction
    /// </summary>
    public int MinerUid { get; set; }
    
    /// <summary>
    /// Time increment used for this prediction
    /// </summary>
    public int TimeIncrement { get; set; }
    
    /// <summary>
    /// Time length (horizon) for this prediction in seconds
    /// </summary>
    public int TimeLength { get; set; }
    
    /// <summary>
    /// Signal date for which this prediction 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>
    /// The actual prediction data from the miner
    /// </summary>
    public MinerPrediction Prediction { get; set; }
    
    /// <summary>
    /// When this prediction data was created/stored
    /// </summary>
    public DateTime CreatedAt { get; set; }
    
    /// <summary>
    /// Generates a cache key for this prediction entry
    /// </summary>
    public string GetCacheKey()
    {
        var key = $"{Asset}_{TimeIncrement}_{TimeLength}_{MinerUid}";
        if (IsBacktest && SignalDate.HasValue)
        {
            key += $"_backtest_{SignalDate.Value:yyyy-MM-dd-HH}";
        }
        return key;
    }
} 