using Managing.Application.Bots.Models; using Managing.Domain.Accounts; using Managing.Domain.Bots; using Managing.Domain.Trades; using static Managing.Common.Enums; namespace Managing.Application.Abstractions; public interface IBotService { Task> GetBotsAsync(); Task> GetBotsByStatusAsync(BotStatus status); Task StopBot(Guid identifier); Task RestartBot(Guid identifier); Task DeleteBot(Guid identifier); Task UpdateBotConfiguration(Guid identifier, TradingBotConfig newConfig); Task> GetActiveBotsNamesAsync(); Task> GetBotsByUser(int id); Task> GetBotsByIdsAsync(IEnumerable botIds); Task GetBotByName(string name); Task GetBotByIdentifier(Guid identifier); Task OpenPositionManuallyAsync(Guid identifier, TradeDirection direction); Task ClosePositionAsync(Guid identifier, Guid positionId); Task GetBotConfig(Guid identifier); Task> GetBotConfigsByIdsAsync(IEnumerable botIds); Task UpdateBotStatisticsAsync(Guid identifier); Task SaveBotStatisticsAsync(Bot bot); /// /// Computes the remaining available USDC allocation for the provided account, /// subtracting the sum of BotTradingBalance from other bots using the same account. /// Optionally exclude a specific bot identifier from the allocation sum (useful for restarts/updates). /// /// Target account. /// Bot identifier to exclude from allocation sum. /// Available USDC amount that can be allocated. Task GetAvailableAllocationUsdAsync(Account account, Guid excludeIdentifier = default); /// /// Gets paginated bots with filtering and sorting /// /// Page number (1-based) /// Number of items per page /// Filter by status (optional) /// Filter by name (partial match, case-insensitive) /// Filter by ticker (partial match, case-insensitive) /// Filter by agent name (partial match, case-insensitive) /// Sort field /// Sort direction ("Asc" or "Desc") /// Tuple containing the bots for the current page and total count Task<(IEnumerable Bots, int TotalCount)> GetBotsPaginatedAsync( int pageNumber, int pageSize, BotStatus? status = null, string? name = null, string? ticker = null, string? agentName = null, string sortBy = "CreateDate", string sortDirection = "Desc"); /// /// Checks USDC and ETH balances for EVM/GMX V2 accounts /// /// The account to check balances for /// Balance check result Task CheckAccountBalancesAsync(Account account); }