using Managing.Domain.Indicators;
using Managing.Domain.Trades;
using Orleans;
using static Managing.Common.Enums;

namespace Managing.Domain.Bots;

/// <summary>
/// Response model for trading bot data.
/// Used to return comprehensive bot information via Orleans grains.
/// </summary>
[GenerateSerializer]
public class LiveTradingBotModel
{
    /// <summary>
    /// Bot identifier
    /// </summary>
    [Id(0)]
    public Guid Identifier { get; set; } = Guid.Empty;

    /// <summary>
    /// Bot display name
    /// </summary>
    [Id(1)]
    public string Name { get; set; } = string.Empty;

    /// <summary>
    /// Current bot status
    /// </summary>
    [Id(2)]
    public BotStatus Status { get; set; }

    /// <summary>
    /// Bot configuration
    /// </summary>
    [Id(3)]
    public TradingBotConfig Config { get; set; }

    /// <summary>
    /// Trading positions dictionary, keyed by position identifier
    /// </summary>
    [Id(4)]
    public Dictionary<Guid, Position> Positions { get; set; } = new();

    /// <summary>
    /// Trading signals dictionary, keyed by signal identifier
    /// </summary>
    [Id(5)]
    public Dictionary<string, LightSignal> Signals { get; set; } = new();

    /// <summary>
    /// Wallet balance history
    /// </summary>
    [Id(6)]
    public Dictionary<DateTime, decimal> WalletBalances { get; set; } = new();

    /// <summary>
    /// Current profit and loss
    /// </summary>
    [Id(7)]
    public decimal ProfitAndLoss { get; set; }

    /// <summary>
    /// Win rate percentage
    /// </summary>
    [Id(8)]
    public int WinRate { get; set; }

    /// <summary>
    /// Execution count
    /// </summary>
    [Id(9)]
    public long ExecutionCount { get; set; }

    /// <summary>
    /// Startup time
    /// </summary>
    [Id(10)]
    public DateTime StartupTime { get; set; }

    /// <summary>
    /// Creation date
    /// </summary>
    [Id(11)]
    public DateTime CreateDate { get; set; }

    /// <summary>
    /// Current balance
    /// </summary>
    [Id(12)]
    public decimal CurrentBalance { get; set; }

    /// <summary>
    /// Number of active positions
    /// </summary>
    [Id(13)]
    public int ActivePositionsCount { get; set; }

    /// <summary>
    /// Last execution time
    /// </summary>
    [Id(14)]
    public DateTime LastExecution { get; set; }
}