using Knot.Modules.Messaging.Domain;

namespace Knot.Modules.Messaging.Domain;

public interface IMessageRepository
{
    void Add(Message message);
    Task<Message?> GetByIdAsync(Guid id, CancellationToken cancellationToken);
    Task<List<Message>> GetChatMessagesAsync(Guid chatId, int limit, int offset, CancellationToken cancellationToken);
    Task<Message?> GetLatestChatMessageAsync(Guid chatId, CancellationToken cancellationToken);
    Task<List<Message>> SearchMessagesAsync(string query, Guid? chatId, Guid requestingUserId, CancellationToken cancellationToken);

    Task<List<Message>> GetChatMessagesCursorAsync(Guid chatId, DateTime? cursor, int limit, CancellationToken cancellationToken);
    Task<Message?> GetLastStoryMessageAsync(Guid chatId, Guid storyId, CancellationToken cancellationToken);

    Task UpdateAsync(Message message, CancellationToken cancellationToken);
    Task<List<Message>> GetAllMessagesAsync(CancellationToken cancellationToken);
    Task DeleteChatMessagesAsync(Guid chatId, CancellationToken cancellationToken);
    Task DeleteUserMessagesAsync(Guid userId, CancellationToken cancellationToken);
    Task RemoveAsync(Guid id, CancellationToken cancellationToken);
}


