using Predictalytics.Domain.Entities;
using Predictalytics.Domain.Enums;

namespace Predictalytics.Domain.Interfaces;

public interface IMarketRepository
{
    Task<Market?> GetByPlatformIdAsync(PlatformType platform, string platformMarketId, CancellationToken ct = default);
    Task<MarketOutcome?> GetOutcomeByTokenIdAsync(string tokenId, CancellationToken ct = default);
    Task<IReadOnlyList<MarketOutcome>> GetOutcomesByTokenIdsAsync(IEnumerable<string> tokenIds, CancellationToken ct = default);
    Task AddOrUpdateAsync(Market market, CancellationToken ct = default);
    Task AddOrUpdateRangeAsync(IEnumerable<Market> markets, CancellationToken ct = default);
    Task AddOrUpdateEventsAsync(IEnumerable<Event> events, CancellationToken ct = default);
    Task<IReadOnlyList<Market>> GetActiveAsync(int count = 50, CancellationToken ct = default);
    Task<int> GetCountAsync(CancellationToken ct = default);
    Task<IReadOnlyList<Market>> GetMarketsDueForTradeUpdateAsync(int cooldownHours, int limit, CancellationToken ct = default);
    Task UpdateAsync(Market market, CancellationToken ct = default);
    Task<Market?> GetByIdAsync(int id, CancellationToken ct = default);
    Task<IReadOnlyList<Market>> SearchAsync(string query, int take = 20, CancellationToken ct = default);
    Task<IReadOnlyList<MarketOutcomePriceSnapshot>> GetPriceSnapshotsAsync(int marketOutcomeId, CancellationToken ct = default);
    Task SavePriceSnapshotsAsync(int marketOutcomeId, IEnumerable<MarketOutcomePriceSnapshot> snapshots, CancellationToken ct = default);
}
