using Managing.Domain.Bots;
using Managing.Domain.Trades;
using Managing.Domain.Users;
using static Managing.Common.Enums;
namespace Managing.Application.Bots;
///
/// Orleans grain state for TradingBot.
/// This class represents the persistent state of a trading bot grain.
/// All properties must be serializable for Orleans state management.
///
[GenerateSerializer]
public class TradingBotGrainState
{
///
/// The trading bot configuration
///
[Id(0)]
public TradingBotConfig Config { get; set; } = new();
///
/// Collection of trading signals generated by the bot
///
[Id(1)]
public HashSet Signals { get; set; } = new();
///
/// List of trading positions opened by the bot
///
[Id(2)]
public List Positions { get; set; } = new();
///
/// Historical wallet balances tracked over time
///
[Id(3)]
public Dictionary WalletBalances { get; set; } = new();
///
/// Current status of the bot (Running, Stopped, etc.)
///
[Id(4)]
public BotStatus Status { get; set; } = BotStatus.Down;
///
/// When the bot was started
///
[Id(5)]
public DateTime StartupTime { get; set; } = DateTime.UtcNow;
///
/// When the bot was created
///
[Id(6)]
public DateTime CreateDate { get; set; } = DateTime.UtcNow;
///
/// The user who owns this bot
///
[Id(7)]
public User User { get; set; }
///
/// Bot execution counter
///
[Id(8)]
public long ExecutionCount { get; set; } = 0;
///
/// Bot identifier/name
///
[Id(9)]
public string Identifier { get; set; } = string.Empty;
///
/// Bot display name
///
[Id(10)]
public string Name { get; set; } = string.Empty;
///
/// Preload start date for candles
///
[Id(11)]
public DateTime PreloadSince { get; set; } = DateTime.UtcNow;
///
/// Number of preloaded candles
///
[Id(12)]
public int PreloadedCandlesCount { get; set; } = 0;
///
/// Timer interval for bot execution
///
[Id(13)]
public int Interval { get; set; } = 60000; // Default 1 minute
///
/// Maximum number of signals to keep in memory
///
[Id(14)]
public int MaxSignals { get; set; } = 10;
///
/// Indicates if the bot has been initialized
///
[Id(15)]
public bool IsInitialized { get; set; } = false;
///
/// Last time the bot state was persisted
///
[Id(16)]
public DateTime LastBackupTime { get; set; } = DateTime.UtcNow;
}