using Predictalytics.Domain.Entities; using Predictalytics.Domain.Enums; namespace Predictalytics.Domain.Interfaces; public interface ITraderRepository { Task GetByIdAsync(int id, CancellationToken ct = default); Task GetByPlatformIdAsync(PlatformType platform, string platformUserId, CancellationToken ct = default); Task> GetAllAsync(PlatformType? platform = null, int skip = 0, int take = 50, CancellationToken ct = default); Task> GetWatchlistedAsync(CancellationToken ct = default); Task> GetTopByScoreAsync(int count = 20, CancellationToken ct = default); Task> GetTopByPnLAsync(int count = 5, DateTime? since = null, CancellationToken ct = default); Task GetCountAsync(PlatformType? platform = null, CancellationToken ct = default); Task AddAsync(Trader trader, CancellationToken ct = default); Task UpdateAsync(Trader trader, CancellationToken ct = default); Task DeleteAsync(int id, CancellationToken ct = default); /// Get traders that need trade history update (LastTradesUpdatedAt is null or older than given hours). Task> GetTradersDueForTradeUpdateAsync(int cooldownHours = 6, int take = 20, CancellationToken ct = default); /// Get traders that haven't been polled in a long time or have a prolonged API error for cleanup. Task> GetTradersForCleanupAsync(DateTime inactiveSince, DateTime errorSince, int take = 50, CancellationToken ct = default); /// Get traders ordered by LastPolledAt to ensure round-robin polling of all traders. Task> GetTradersForPollingAsync(int take, CancellationToken ct = default); Task> SearchAsync(string query, int take = 20, CancellationToken ct = default); }