using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Timeline.Models;
using Timeline.Services.Exceptions;
namespace Timeline.Services
{
[Serializable]
public class InvalidBookmarkException : Exception
{
public InvalidBookmarkException() { }
public InvalidBookmarkException(string message) : base(message) { }
public InvalidBookmarkException(string message, Exception inner) : base(message, inner) { }
protected InvalidBookmarkException(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
}
///
/// Service interface that manages timeline bookmarks.
///
public interface IBookmarkTimelineService
{
///
/// Get bookmarks of a user.
///
/// User id of bookmark owner.
/// Bookmarks in order.
/// Thrown when user does not exist.
Task> GetBookmarks(long userId);
///
/// Add a bookmark to tail to a user.
///
/// User id of bookmark owner.
/// Timeline name.
/// Thrown when is null.
/// Thrown when is not a valid name.
/// Thrown when user does not exist.
/// Thrown when timeline does not exist.
Task AddBookmark(long userId, string timelineName);
///
/// Remove a bookmark from a user.
///
/// User id of bookmark owner.
/// Timeline name.
/// True if deletion is performed. False if bookmark does not exist.
/// Thrown when is null.
/// Thrown when is not a valid name.
/// Thrown when user does not exist.
/// Thrown when timeline does not exist.
Task RemoveBookmark(long userId, string timelineName);
///
/// Move bookmark to a new position.
///
/// User id of bookmark owner.
/// Timeline name.
/// New position. Starts at 1.
/// Thrown when is null.
/// Thrown when is not a valid name.
/// Thrown when user does not exist.
/// Thrown when timeline does not exist.
/// Thrown when the timeline is not a bookmark.
Task MoveBookmark(long userId, string timelineName, long position);
}
public class BookmarkTimelineService
{
}
}