using Managing.Domain.Backtests;
using Managing.Domain.Users;

namespace Managing.Application.Abstractions.Repositories;

public interface IBacktestRepository
{
    void InsertBacktestForUser(User user, Backtest result);
    IEnumerable<Backtest> GetBacktestsByUser(User user);
    Task<IEnumerable<Backtest>> GetBacktestsByUserAsync(User user);
    IEnumerable<Backtest> GetBacktestsByRequestId(string requestId);
    Task<IEnumerable<Backtest>> GetBacktestsByRequestIdAsync(string requestId);

    (IEnumerable<LightBacktest> Backtests, int TotalCount) GetBacktestsByRequestIdPaginated(string requestId, int page,
        int pageSize, string sortBy = "score", string sortOrder = "desc");

    Task<(IEnumerable<LightBacktest> Backtests, int TotalCount)> GetBacktestsByRequestIdPaginatedAsync(string requestId,
        int page,
        int pageSize, string sortBy = "score", string sortOrder = "desc");

    (IEnumerable<LightBacktest> Backtests, int TotalCount) GetBacktestsByUserPaginated(User user, int page,
        int pageSize, string sortBy = "score", string sortOrder = "desc");

    Task<(IEnumerable<LightBacktest> Backtests, int TotalCount)> GetBacktestsByUserPaginatedAsync(User user, int page,
        int pageSize, string sortBy = "score", string sortOrder = "desc");

    Task<Backtest> GetBacktestByIdForUserAsync(User user, string id);
    Task DeleteBacktestByIdForUserAsync(User user, string id);
    Task DeleteBacktestsByIdsForUserAsync(User user, IEnumerable<string> ids);
    void DeleteAllBacktestsForUser(User user);
    Task DeleteBacktestsByRequestIdAsync(string requestId);

    // Bundle backtest methods
    void InsertBundleBacktestRequestForUser(User user, BundleBacktestRequest bundleRequest);
    IEnumerable<BundleBacktestRequest> GetBundleBacktestRequestsByUser(User user);
    Task<IEnumerable<BundleBacktestRequest>> GetBundleBacktestRequestsByUserAsync(User user);
    BundleBacktestRequest? GetBundleBacktestRequestByIdForUser(User user, string id);
    Task<BundleBacktestRequest?> GetBundleBacktestRequestByIdForUserAsync(User user, string id);
    void UpdateBundleBacktestRequest(BundleBacktestRequest bundleRequest);
    Task UpdateBundleBacktestRequestAsync(BundleBacktestRequest bundleRequest);
    void DeleteBundleBacktestRequestByIdForUser(User user, string id);
    Task DeleteBundleBacktestRequestByIdForUserAsync(User user, string id);
    IEnumerable<BundleBacktestRequest> GetBundleBacktestRequestsByStatus(BundleBacktestRequestStatus status);
    Task<IEnumerable<BundleBacktestRequest>> GetBundleBacktestRequestsByStatusAsync(BundleBacktestRequestStatus status);
}