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(Guid requestId);
    Task<IEnumerable<Backtest>> GetBacktestsByRequestIdAsync(Guid requestId);

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

    Task<(IEnumerable<LightBacktest> Backtests, int TotalCount)> GetBacktestsByRequestIdPaginatedAsync(Guid 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(Guid requestId);

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