using System.Diagnostics.CodeAnalysis;
using OliverBooth.Data.Blog;
namespace OliverBooth.Services;
///
/// Represents a service for managing blog posts.
///
public interface IBlogPostService
{
///
/// Returns a collection of all blog posts.
///
/// The maximum number of posts to return. A value of -1 returns all posts.
/// The visibility of the posts to retrieve.
/// A collection of all blog posts.
///
/// This method may slow down execution if there are a large number of blog posts being requested. It is
/// recommended to use instead.
///
IReadOnlyList GetAllBlogPosts(int limit = -1,
BlogPostVisibility visibility = BlogPostVisibility.Published);
///
/// Returns the total number of blog posts.
///
/// The total number of blog posts.
int GetBlogPostCount();
///
/// Returns a collection of blog posts from the specified page, optionally limiting the number of posts
/// returned per page.
///
/// The zero-based index of the page to return.
/// The maximum number of posts to return per page.
/// A collection of blog posts.
IReadOnlyList GetBlogPosts(int page, int pageSize = 10);
///
/// Returns the drafts of this post, sorted by their update timestamp.
///
/// The post whose drafts to return.
/// The drafts of the .
/// is .
IReadOnlyList GetDrafts(IBlogPost post);
///
/// Returns the next blog post from the specified blog post.
///
/// The blog post whose next post to return.
/// The next blog post from the specified blog post.
IBlogPost? GetNextPost(IBlogPost blogPost);
///
/// Returns the previous blog post from the specified blog post.
///
/// The blog post whose previous post to return.
/// The previous blog post from the specified blog post.
IBlogPost? GetPreviousPost(IBlogPost blogPost);
///
/// Renders the excerpt of the specified blog post.
///
/// The blog post whose excerpt to render.
///
/// When this method returns, contains if the excerpt was trimmed; otherwise,
/// .
///
/// The rendered HTML of the blog post's excerpt.
string RenderExcerpt(IBlogPost post, out bool wasTrimmed);
///
/// Renders the body of the specified blog post.
///
/// The blog post to render.
/// The rendered HTML of the blog post.
string RenderPost(IBlogPost post);
///
/// Attempts to find a blog post with the specified ID.
///
/// The ID of the blog post to find.
///
/// When this method returns, contains the blog post with the specified ID, if the blog post is found;
/// otherwise, .
///
///
/// if a blog post with the specified ID is found; otherwise, .
///
bool TryGetPost(Guid id, [NotNullWhen(true)] out IBlogPost? post);
///
/// Attempts to find a blog post with the specified WordPress ID.
///
/// The ID of the blog post to find.
///
/// When this method returns, contains the blog post with the specified WordPress ID, if the blog post is found;
/// otherwise, .
///
///
/// if a blog post with the specified WordPress ID is found; otherwise,
/// .
///
bool TryGetPost(int id, [NotNullWhen(true)] out IBlogPost? post);
///
/// Attempts to find a blog post with the specified publish date and URL slug.
///
/// The date the blog post was published.
/// The URL slug of the blog post to find.
///
/// When this method returns, contains the blog post with the specified publish date and URL slug, if the blog
/// post is found; otherwise, .
///
///
/// if a blog post with the specified publish date and URL slug is found; otherwise,
/// .
///
/// is .
bool TryGetPost(DateOnly publishDate, string slug, [NotNullWhen(true)] out IBlogPost? post);
///
/// Updates the specified post.
///
/// The post to edit.
/// is .
void UpdatePost(IBlogPost post);
}