2026-10-04 10:07:06 +02:00
using MongoDB.Bson.Serialization.Attributes ;
2026-10-01 08:05:56 +02:00
using MongoDB.Entities ;
2023-02-18 08:52:17 +01:00
2023-02-19 00:43:43 +01:00
namespace PrivaPub.Models.Post
2023-02-18 08:52:17 +01:00
{
public class Post : Entity
{
2026-10-01 11:17:14 +02:00
public string GroupUserId { get ; set ; } //local author's Avatar.ID
public string AuthorAccountId { get ; set ; } //Avatar.ID or ForeignAvatar.ID
public string AnsweringToPostId { get ; set ; } //the parent's Post.ID when we hold it
public string InReplyToURI { get ; set ; }
public string InReplyToAccountId { get ; set ; }
2023-02-18 08:52:17 +01:00
public string GroupId { get ; set ; }
2026-10-01 11:17:14 +02:00
public string ConversationId { get ; set ; } //DmGroup.ID of a direct post
2026-10-01 12:30:57 +02:00
public string AudienceURI { get ; set ; } //a remote community the post was made in
2026-10-01 11:17:14 +02:00
public string ReblogOfPostId { get ; set ; }
public PostVisibility Visibility { get ; set ; }
2023-02-18 08:52:17 +01:00
public string Title { get ; set ; }
2026-10-01 11:17:14 +02:00
public string SpoilerText { get ; set ; }
2026-10-01 17:39:58 +02:00
public string Excerpt { get ; set ; } //a non-Note's summary: a teaser, a description, an event's date and place
2023-02-18 08:52:17 +01:00
public string Text { get ; set ; }
2026-10-01 10:54:17 +02:00
public string ContentHtml { get ; set ; }
public ContentFormat ContentFormat { get ; set ; }
2026-10-01 11:17:14 +02:00
public string Language { get ; set ; }
public List < PostMention > Mentions { get ; set ; } = new ();
public List < string > Tags { get ; set ; } = new ();
2023-02-18 08:52:17 +01:00
public List < PostMedia > Media { get ; set ; } = new ();
2026-10-01 18:35:20 +02:00
public List < CustomEmoji > Emojis { get ; set ; } = new ();
2026-10-01 17:53:59 +02:00
[BsonIgnoreIfNull]
public PostSource Source { get ; set ; } //the remote author's own text (Markdown, MFM, BBCode)
[BsonIgnoreIfNull]
public string CoverURL { get ; set ; } //a remote object's own image: article cover, video poster, event banner
[BsonIgnoreIfNull]
public PostLink Link { get ; set ; }
[BsonIgnoreIfNull]
public VideoDetails Video { get ; set ; }
[BsonIgnoreIfNull]
public AudioDetails Audio { get ; set ; }
[BsonIgnoreIfNull]
public EventDetails Event { get ; set ; }
2026-10-01 18:35:20 +02:00
[BsonIgnoreIfNull]
2026-10-04 10:07:06 +02:00
public PostPlace Place { get ; set ; }
[BsonIgnoreIfNull]
2026-10-01 18:35:20 +02:00
public PostPoll Poll { get ; set ; }
2023-02-18 08:52:17 +01:00
public List < float > Location { get ; set ; } = new ();
public float RangeKm { get ; set ; } = 5.0f ;
2026-10-01 12:24:30 +02:00
[BsonIgnoreIfNull]
public Coordinates2D Geo { get ; set ; }
[BsonIgnoreIfNull]
public double? Distance { get ; set ; }
2023-02-18 08:52:17 +01:00
public bool HasContentWarning { get ; set ; } = false ;
2026-10-01 10:57:01 +02:00
public bool IsLocalOnly { get ; set ; }
2026-10-03 11:51:19 +02:00
public bool AuthorGone { get ; set ; } //its remote author deleted their account: kept, but hidden everywhere (VisibilityPolicy)
2023-02-18 08:52:17 +01:00
public bool IsFederatedCopy { get ; set ; }
2026-10-01 08:05:56 +02:00
public string ObjectURI { get ; set ; } //the Note's id
2026-10-01 17:39:58 +02:00
public string ObjectType { get ; set ; } //the remote object's type: Note, Article, Page, Video, Event…; null for local posts
2026-10-01 11:17:14 +02:00
public string ActivityURI { get ; set ; } //the Create's id
2026-10-01 08:05:56 +02:00
public string ActorURI { get ; set ; } //attributedTo
2026-10-01 11:17:14 +02:00
public string Url { get ; set ; }
public string ContextURI { get ; set ; }
public string QuoteURI { get ; set ; }
2026-10-01 18:53:28 +02:00
public string QuotedPostId { get ; set ; } //our copy of the quoted post, once fetched
public QuoteState QuoteState { get ; set ; }
public string QuoteAuthorizationURI { get ; set ; } //FEP-044f: the quoted author's stamp
2026-10-01 19:53:13 +02:00
public bool QuoteByConsent { get ; set ; }
public string LocalQuotePolicy { get ; set ; } //who may quote this local post: QuotePolicies.Public, Followers or Nobody//our quote of a post whose server asks for consent (FEP-044f), so `quote` is sent
2026-10-01 18:53:28 +02:00
public int QuotesCount { get ; set ; }
[BsonIgnoreIfNull]
public InteractionRule QuotePolicy { get ; set ; } //a remote post's interactionPolicy.canQuote; null when it states none
2026-10-01 11:17:14 +02:00
public List < string > To { get ; set ; } = new ();
public List < string > Cc { get ; set ; } = new ();
public int RepliesCount { get ; set ; }
public int FavouritesCount { get ; set ; }
2026-10-01 17:58:22 +02:00
public int DownvotesCount { get ; set ; } //Lemmy, PieFed, Mbin and Friendica Dislikes
2026-10-01 11:17:14 +02:00
public int ReblogsCount { get ; set ; }
public List < PostRevision > Revisions { get ; set ; } = new ();
2023-02-18 08:52:17 +01:00
public DateTime CreationDate { get ; set ; } = DateTime . UtcNow ;
public DateTime ? UpdateDate { get ; set ; } = DateTime . UtcNow ;
2026-10-01 11:17:14 +02:00
public DateTime ? EditedAt { get ; set ; }
public DateTime ? DeletedAt { get ; set ; }
2023-02-18 08:52:17 +01:00
public string UpdateReason { get ; set ; }
}
2026-10-01 11:17:14 +02:00
2026-10-01 18:53:28 +02:00
public enum QuoteState
{
None ,
Pending ,
Accepted ,
Rejected ,
Revoked ,
Deleted ,
Unauthorized
}
2026-10-01 11:17:14 +02:00
public enum PostVisibility
{
Public ,
Unlisted ,
FollowersOnly ,
Direct ,
Circle ,
LocalGeo
}
public class PostMention
{
public string ActorURI { get ; set ; }
public string AccountId { get ; set ; }
public string Handle { get ; set ; }
public bool IsLocal { get ; set ; }
}
public class PostRevision
{
public string Title { get ; set ; }
public string SpoilerText { get ; set ; }
public string ContentHtml { get ; set ; }
public bool HasContentWarning { get ; set ; }
public DateTime EditedAt { get ; set ; }
}
2023-02-18 08:52:17 +01:00
}