using System.Text.Json.Serialization;

namespace Managing.Domain.Synth.Models;

/// <summary>
/// Represents the prediction data from a single miner
/// Contains multiple simulated price paths and the miner's information
/// </summary>
public class MinerPrediction
{
    public string Asset { get; set; }
    [JsonPropertyName("miner_uid")] public int MinerUid { get; set; }
    [JsonPropertyName("num_simulations")] public int NumSimulations { get; set; }
    public List<List<PricePoint>> Prediction { get; set; } = new();
    [JsonPropertyName("start_time")] public string StartTime { get; set; }
    [JsonPropertyName("time_increment")] public int TimeIncrement { get; set; }
    [JsonPropertyName("time_length")] public int TimeLength { get; set; }

    /// <summary>
    /// Complete miner information including rank, stake, incentive, etc.
    /// This is populated after fetching predictions by mapping MinerUid to MinerInfo.NeuronUid
    /// </summary>
    public MinerInfo? MinerInfo { get; set; }

    /// <summary>
    /// Converts the StartTime string to DateTime for easier manipulation
    /// </summary>
    public DateTime GetStartDateTime()
    {
        return DateTime.TryParse(StartTime, out var dateTime) ? dateTime : DateTime.MinValue;
    }
}