using NexusReader.Domain.Entities;

namespace NexusReader.Application.Abstractions.Persistence;

/// <summary>
/// Abstraction for QuizResult and related User entity lookup.
/// Defined in the Application layer to maintain Clean Architecture isolation.
/// </summary>
public interface IQuizResultRepository
{
    /// <summary>
    /// Finds a user by ID to extract tenant context.
    /// </summary>
    Task<NexusUser?> FindUserByIdAsync(string userId, CancellationToken cancellationToken = default);

    /// <summary>
    /// Adds a new quiz result to the database.
    /// </summary>
    void AddQuizResult(QuizResult quizResult);

    /// <summary>
    /// Persists all staged changes to the repository.
    /// </summary>
    Task<int> SaveChangesAsync(CancellationToken cancellationToken = default);
}
