using System.Diagnostics.CodeAnalysis;
using OliverBooth.Common.Data;
using OliverBooth.Common.Data.Blog;
using OliverBooth.Common.Data.Web;
namespace OliverBooth.Common.Services;
///
/// Represents a service which can retrieve tutorial articles.
///
public interface ITutorialService
{
///
/// Gets the articles within a tutorial folder.
///
/// The folder whose articles to retrieve.
/// The visibility to filter by. -1 does not filter.
/// A read-only view of the articles in the folder.
IReadOnlyCollection GetArticles(ITutorialFolder folder, Visibility visibility = Visibility.None);
///
/// Gets the tutorial folders within a specified folder.
///
/// The parent folder.
/// The visibility to filter by. -1 does not filter.
/// A read-only view of the subfolders in the folder.
IReadOnlyCollection GetFolders(ITutorialFolder? parent = null, Visibility visibility = Visibility.None);
///
/// Gets a folder by its ID.
///
/// The ID of the folder to get
///
/// When this method returns, contains the folder whose ID is equal to the ID specified, or
/// if no such folder was found.
///
///
ITutorialFolder? GetFolder(int id);
///
/// Gets a folder by its slug.
///
/// The slug of the folder.
/// The parent folder.
/// The folder.
ITutorialFolder? GetFolder(string? slug, ITutorialFolder? parent = null);
///
/// Gets the full slug of the specified folder.
///
/// The folder whose slug to return.
/// The full slug of the folder.
/// is .
string GetFullSlug(ITutorialFolder folder);
///
/// Gets the full slug of the specified article.
///
/// The article whose slug to return.
/// The full slug of the article.
/// is .
string GetFullSlug(ITutorialArticle article);
///
/// Returns the number of legacy comments for the specified article.
///
/// The article whose legacy comments to count.
/// The total number of legacy comments.
int GetLegacyCommentCount(ITutorialArticle article);
///
/// Returns the collection of legacy comments for the specified article.
///
/// The article whose legacy comments to retrieve.
/// A read-only view of the legacy comments.
IReadOnlyList GetLegacyComments(ITutorialArticle article);
///
/// Returns the collection of replies to the specified legacy comment.
///
/// The comment whose replies to retrieve.
/// A read-only view of the replies.
IReadOnlyList GetLegacyReplies(ILegacyComment comment);
///
/// Renders the body of the specified article.
///
/// The article to render.
/// The rendered HTML of the article.
string RenderArticle(ITutorialArticle article);
///
/// Renders the excerpt of the specified article.
///
/// The article whose excerpt to render.
///
/// When this method returns, contains if the excerpt was trimmed; otherwise,
/// .
///
/// The rendered HTML of the article's excerpt.
string RenderExcerpt(ITutorialArticle article, out bool wasTrimmed);
///
/// Attempts to find an article by its ID.
///
/// The ID of the article.
///
/// When this method returns, contains the article whose ID matches the specified , or
/// if no such article was found.
///
/// if a matching article was found; otherwise, .
bool TryGetArticle(int id, [NotNullWhen(true)] out ITutorialArticle? article);
///
/// Attempts to find an article by its slug.
///
/// The slug of the article.
///
/// When this method returns, contains the article whose slug matches the specified , or
/// if no such article was found.
///
/// if a matching article was found; otherwise, .
bool TryGetArticle(string slug, [NotNullWhen(true)] out ITutorialArticle? article);
}