namespace OliverBooth.Data.Blog;
///
/// Represents a blog post.
///
public sealed class BlogPost : IEquatable
{
///
/// Gets the ID of the author.
///
/// The author ID.
public int AuthorId { get; private set; }
///
/// Gets or sets the body of the blog post.
///
/// The body.
public string Body { get; set; } = string.Empty;
///
/// Gets the ID of the blog post.
///
/// The ID.
public int Id { get; private set; }
///
/// Gets or sets the date and time at which the blog post was published.
///
/// The publish timestamp.
public DateTimeOffset Published { get; set; }
///
/// Gets or sets the URL slug of the blog post.
///
/// The URL slug.
public string Slug { get; set; } = string.Empty;
///
/// Gets or sets the title of the blog post.
///
/// The title.
public string Title { get; set; } = string.Empty;
///
/// Gets or sets the date and time at which the blog post was updated.
///
/// The update timestamp.
public DateTimeOffset? Updated { get; set; }
///
/// Gets or sets the legacy WordPress ID of the blog post.
///
/// The legacy WordPress ID.
public int? WordPressId { get; set; }
public bool Equals(BlogPost? other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return Id == other.Id;
}
public override bool Equals(object? obj)
{
return ReferenceEquals(this, obj) || obj is BlogPost other && Equals(other);
}
public override int GetHashCode()
{
return Id;
}
}