namespace Uwaa.Pleroma;
public class Status
{
///
/// Pleroma uses 128-bit ids as opposed to Mastodon's 64 bits. However just like Mastodon's ids they are lexically sortable strings
///
[JsonPropertyName("id")]
public string ID { get; set; } = null!;
///
/// HTML-encoded status content
///
[JsonPropertyName("content")]
public string HtmlContent { get; set; } = null!;
///
/// The account that authored this status
///
[JsonPropertyName("account")]
public Account Account { get; set; } = null!;
///
/// The date when this status was created
///
[JsonPropertyName("created_at")]
public DateTime CreatedAt { get; set; }
[JsonPropertyName("pleroma")]
public PleromaObject Pleroma { get; set; } = null!;
///
/// ID of the account being replied to
///
[JsonPropertyName("in_reply_to_account_id")]
public string? ReplyToAccount { get; set; } = null;
///
/// ID of the status being replied
///
[JsonPropertyName("in_reply_to_id")]
public string? ReplyToStatus { get; set; } = null;
///
/// Mentions of users within the status content
///
[JsonPropertyName("mentions")]
public Mention[] Mentions { get; set; } = Array.Empty();
///
/// Primary language of this status
///
[JsonPropertyName("language")]
public string? Language { get; set; }
///
/// Have you pinned this status? Only appears if the status is pinnable.
///
[JsonPropertyName("pinned")]
public bool Pinned { get; set; }
///
/// Visibility of this status
///
[JsonPropertyName("visibility")]
public StatusVisibility Visibility { get; set; }
///
/// Plain text content of that status.
///
[JsonIgnore]
public string Content => Pleroma?.Content?.Plain ?? HtmlContent;
public bool CheckMention(string id)
{
return ReplyToAccount == id || Mentions.Any(m => m.ID == id);
}
public override string ToString() => $"{Account?.Username ?? "unknown"}: \"{Content}\"";
}
public class Mention
{
public static implicit operator string(Mention mention) => mention.ID;
///
/// The webfinger acct: URI of the mentioned user. Equivalent to username for local users, or username@domain for remote users.
///
[JsonPropertyName("acct")]
public string Account { get; set; } = null!;
///
/// The account id of the mentioned user
///
[JsonPropertyName("id")]
public string ID { get; set; } = null!;
///
/// The location of the mentioned user's profile
///
[JsonPropertyName("url")]
public string URL { get; set; } = null!;
///
/// The username of the mentioned user
///
[JsonPropertyName("username")]
public string Username { get; set; } = null!;
public override string ToString() => $"@{Account}";
}