using Orleans; using static Managing.Common.Enums; namespace Managing.Application.Abstractions.Grains; /// /// Orleans grain interface for LiveBotRegistry operations. /// This interface defines the distributed, async operations available for the bot registry. /// The registry acts as a central, durable directory for all LiveTradingBot grains. /// public interface ILiveBotRegistryGrain : IGrainWithIntegerKey { /// /// Registers a new bot with its user ID. This should be called by the LiveTradingBotGrain when it is first initialized. /// The initial status will be BotStatus.Up. /// /// The unique identifier of the bot /// The unique identifier of the user who owns the bot /// A task that represents the asynchronous operation Task RegisterBot(Guid identifier, int userId); /// /// Removes a bot from the registry. This should be a full removal, perhaps called when a user permanently deletes a bot. /// /// The unique identifier of the bot to unregister /// A task that represents the asynchronous operation Task UnregisterBot(Guid identifier); /// /// Returns a list of all bots in the registry. This is for a management dashboard to see all bots in the system. /// /// A list of all BotRegistryEntry objects in the registry Task> GetAllBots(); /// /// Returns a list of all bots associated with a specific user. This is the primary method for a user's watchlist. /// /// The unique identifier of the user /// A list of BotRegistryEntry objects for the specified user Task> GetBotsForUser(int userId); /// /// A dedicated method for updating only the bot's Status field (Up/Down). /// This will be called by LiveTradingBot's StartAsync and StopAsync methods. /// /// The unique identifier of the bot /// The new status to set for the bot /// A task that represents the asynchronous operation Task UpdateBotStatus(Guid identifier, BotStatus status); Task GetBotStatus(Guid identifier); }