using System;

namespace PolyTraderSharp.Models
{
    /// <summary>
    /// Generischer, modulübergreifender Trade-Log-Eintrag (Collection "trade_log").
    /// Jedes Modul, das Trades abschließt, schreibt hier einen neutralen Eintrag —
    /// so kann das Core-Dashboard die Trades ALLER Module gemeinsam auswerten.
    /// Modulspezifische Details (z.B. Copytrading-SourceTrader) bleiben im jeweiligen
    /// Modul-Log (z.B. ClosedTrade).
    /// </summary>
    public class TradeRecord
    {
        public string Id { get; set; } = Guid.NewGuid().ToString("N");

        /// <summary>Herkunftsmodul, z.B. "CopyTrading".</summary>
        public string ModuleName { get; set; } = string.Empty;

        public int AccountId { get; set; }
        public bool IsDemo { get; set; }

        public string TokenId { get; set; } = string.Empty;
        public string MarketQuestion { get; set; } = string.Empty;
        public string Outcome { get; set; } = string.Empty;
        public string Side { get; set; } = string.Empty;

        public decimal EntryPrice { get; set; }
        public decimal ExitPrice { get; set; }
        public decimal Size { get; set; }

        public decimal RealizedPnl { get; set; }
        public decimal PnlPercent { get; set; }

        public DateTime OpenedAt { get; set; }
        public DateTime ClosedAt { get; set; }
        public string ExitReason { get; set; } = string.Empty;

        /// <summary>Korrelation zum Entscheidungsjournal/Order-Events (leer bei Alt-Daten).</summary>
        public string SignalId { get; set; } = string.Empty;
    }
}
