namespace Predictalytics.Domain.Entities;

/// <summary>
/// A point-in-time capture of a trader's strategy fingerprint. Unlike <see cref="TraderAnalytics"/>
/// (one row per trader, overwritten every recalculation), these accumulate over time to form the
/// history that strategy-drift detection (#3) and edge-freshness (#5) compare against a baseline.
/// Captured roughly daily for copy-relevant traders.
/// </summary>
public class TraderFingerprintSnapshot
{
    public int Id { get; set; }

    public int TraderId { get; set; }

    /// <summary>UTC timestamp of the capture.</summary>
    public DateTime CapturedAt { get; set; } = DateTime.UtcNow;

    // ── Fingerprint dimensions (mirrored from TraderAnalytics at capture time) ──

    /// <summary>Copytrading suitability score (0-100) at capture time.</summary>
    public decimal CopytradingScore { get; set; }

    /// <summary>Herfindahl index of category volume shares (0..1; 1 = single-category specialist).</summary>
    public decimal CategoryConcentration { get; set; }

    /// <summary>Conviction edge: return% of the biggest-bet third minus the smallest-bet third. Null when undefined.</summary>
    public decimal? ConvictionEdgePct { get; set; }

    public decimal P50PositionSize { get; set; }
    public decimal P90PositionSize { get; set; }
    public decimal MedianHoldDurationHours { get; set; }
    public decimal TradesPerWeek { get; set; }

    /// <summary>JSON map of category =&gt; volume share (0..1) at capture time, for category-mix drift.</summary>
    public string? CategoryMixJson { get; set; }

    /// <summary>JSON array of the trait keys present at capture time, for trait-set drift.</summary>
    public string? TraitSetJson { get; set; }

    // Navigation
    public Trader Trader { get; set; } = null!;
}
