using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using GermanApp.Domain.Entities; namespace GermanApp.Domain.Interfaces; /// /// Repository interface for managing StorySegment entities. /// This is part of the Domain layer. /// public interface IStoryRepository { /// /// Gets a story segment by its ID. /// /// The segment ID /// Cancellation token /// The story segment or null if not found Task GetByIdAsync(int id, CancellationToken cancellationToken = default); /// /// Gets all story segments for a specific level. /// /// The level ID /// Whether to include inactive segments /// Cancellation token /// List of story segments ordered by Order Task> GetByLevelAsync( int levelId, bool includeInactive = false, CancellationToken cancellationToken = default); /// /// Gets all story segments for a specific lesson. /// /// The lesson ID /// Cancellation token /// List of story segments associated with the lesson Task> GetByLessonAsync( int lessonId, CancellationToken cancellationToken = default); /// /// Gets the next segment to unlock for a user after completing a lesson. /// /// The level ID /// The order of the completed lesson /// Cancellation token /// The next story segment to unlock, or null if none Task GetNextSegmentToUnlockAsync( int levelId, int completedLessonOrder, CancellationToken cancellationToken = default); /// /// Gets story segments by their order range. /// /// The level ID /// Starting order (inclusive) /// Ending order (inclusive) /// Cancellation token /// List of story segments in the specified order range Task> GetByOrderRangeAsync( int levelId, int startOrder, int endOrder, CancellationToken cancellationToken = default); /// /// Adds a new story segment. /// /// The story segment to add /// Cancellation token /// The added segment with generated ID Task AddAsync(StorySegment segment, CancellationToken cancellationToken = default); /// /// Updates an existing story segment. /// /// The story segment to update /// Cancellation token Task UpdateAsync(StorySegment segment, CancellationToken cancellationToken = default); /// /// Deletes a story segment by its ID. /// /// The segment ID /// Cancellation token Task DeleteAsync(int id, CancellationToken cancellationToken = default); /// /// Gets the highest order value for segments in a level. /// /// The level ID /// Cancellation token /// The highest order value, or 0 if no segments exist Task GetMaxOrderAsync(int levelId, CancellationToken cancellationToken = default); /// /// Checks if a story segment exists for the given ID. /// /// The segment ID /// Cancellation token /// True if the segment exists Task ExistsAsync(int id, CancellationToken cancellationToken = default); /// /// Gets all story segments that need audio generation. /// /// Cancellation token /// List of segments with null or empty AudioUrl Task> GetSegmentsNeedingAudioAsync( CancellationToken cancellationToken = default); }