using Managing.Domain.Bots;
using Managing.Domain.Users;
using Managing.Domain.Workflows;
using static Managing.Common.Enums;

namespace Managing.Application.Abstractions;

public interface IBotService
{
    void SaveOrUpdateBotBackup(User user, string identifier, BotType botType, BotStatus status, string data);
    void AddSimpleBotToCache(IBot bot);
    void AddTradingBotToCache(ITradingBot bot);
    List<ITradingBot> GetActiveBots();
    IEnumerable<BotBackup> GetSavedBots();
    void StartBotFromBackup(BotBackup backupBot);
    BotBackup GetBotBackup(string identifier);

    /// <summary>
    /// Creates a trading bot using the unified TradingBot class
    /// </summary>
    /// <param name="config">The trading bot configuration</param>
    /// <returns>ITradingBot instance</returns>
    ITradingBot CreateTradingBot(TradingBotConfig config);
    
    /// <summary>
    /// Creates a trading bot for backtesting using the unified TradingBot class
    /// </summary>
    /// <param name="config">The trading bot configuration</param>
    /// <returns>ITradingBot instance configured for backtesting</returns>
    ITradingBot CreateBacktestTradingBot(TradingBotConfig config);

    // Legacy methods - these will use TradingBot internally but maintain backward compatibility
    ITradingBot CreateScalpingBot(TradingBotConfig config);
    ITradingBot CreateBacktestScalpingBot(TradingBotConfig config);
    ITradingBot CreateFlippingBot(TradingBotConfig config);
    ITradingBot CreateBacktestFlippingBot(TradingBotConfig config);

    IBot CreateSimpleBot(string botName, Workflow workflow);
    Task<string> StopBot(string botName);
    Task<bool> DeleteBot(string botName);
    Task<string> RestartBot(string botName);
    void ToggleIsForWatchingOnly(string botName);
    Task<bool> UpdateBotConfiguration(string identifier, TradingBotConfig newConfig);
}