using Managing.Domain.Accounts;
using Managing.Domain.Bots;
using Managing.Domain.Trades;
using Managing.Domain.Users;
using Orleans;
using static Managing.Common.Enums;

namespace Managing.Application.Abstractions.Grains;

/// <summary>
/// Orleans grain interface for TradingBot operations.
/// This interface defines the distributed, async operations available for trading bots.
/// </summary>
public interface ILiveTradingBotGrain : IGrainWithGuidKey
{
    /// <summary>
    /// Manually opens a position in the specified direction
    /// </summary>
    /// <param name="direction">The direction of the trade (Long/Short)</param>
    /// <returns>The created Position object</returns>
    Task<Position> OpenPositionManuallyAsync(TradeDirection direction);

    /// <summary>
    /// Gets comprehensive bot data including positions, signals, and performance metrics
    /// </summary>
    Task<LiveTradingBotModel> GetBotDataAsync();

    Task CreateAsync(TradingBotConfig config, User user);
    Task StartAsync();
    Task StopAsync();

    Task<bool> UpdateConfiguration(TradingBotConfig newConfig);
    Task<Account> GetAccount();
    Task<TradingBotConfig> GetConfiguration();
    Task<Position> ClosePositionAsync(Guid positionId);
    Task RestartAsync();

    /// <summary>
    /// Deletes the bot and cleans up all associated resources
    /// </summary>
    Task DeleteAsync();
}