using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using GermanApp.Domain.Entities; namespace GermanApp.Domain.Interfaces; /// /// Repository interface for managing StoryProgress entities. /// This is part of the Domain layer. /// public interface IStoryProgressRepository { /// /// Gets story progress for a specific user and level. /// /// The user ID /// The level ID /// Cancellation token /// List of story progress records for the user and level Task> GetByUserAndLevelAsync( int userId, int levelId, CancellationToken cancellationToken = default); /// /// Gets story progress for a specific user and segment. /// /// The user ID /// The story segment ID /// Cancellation token /// The story progress record, or null if not found Task GetByUserAndSegmentAsync( int userId, int storySegmentId, CancellationToken cancellationToken = default); /// /// Gets the highest unlocked segment order for a user in a level. /// /// The user ID /// The level ID /// Cancellation token /// The highest order of unlocked segments, or 0 if none Task GetHighestUnlockedOrderAsync( int userId, int levelId, CancellationToken cancellationToken = default); /// /// Checks if a user has unlocked a specific story segment. /// /// The user ID /// The story segment ID /// Cancellation token /// True if the segment is unlocked Task IsSegmentUnlockedAsync( int userId, int storySegmentId, CancellationToken cancellationToken = default); /// /// Checks if a user has completed (read/listened to) a specific story segment. /// /// The user ID /// The story segment ID /// Cancellation token /// True if the segment is completed Task IsSegmentCompletedAsync( int userId, int storySegmentId, CancellationToken cancellationToken = default); /// /// Adds a new story progress record. /// /// The story progress to add /// Cancellation token /// The added progress with generated ID Task AddAsync(StoryProgress progress, CancellationToken cancellationToken = default); /// /// Updates an existing story progress record. /// /// The story progress to update /// Cancellation token Task UpdateAsync(StoryProgress progress, CancellationToken cancellationToken = default); /// /// Gets the total count of story segments for a level. /// /// The level ID /// Cancellation token /// The total number of segments in the level Task GetTotalSegmentsForLevelAsync(int levelId, CancellationToken cancellationToken = default); /// /// Gets the count of unlocked segments for a user in a level. /// /// The user ID /// The level ID /// Cancellation token /// The number of unlocked segments Task GetUnlockedCountAsync( int userId, int levelId, CancellationToken cancellationToken = default); /// /// Gets the count of completed segments for a user in a level. /// /// The user ID /// The level ID /// Cancellation token /// The number of completed segments Task GetCompletedCountAsync( int userId, int levelId, CancellationToken cancellationToken = default); }