2020-02-12 14:16:19 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
|
|
|
|
using NodaTime;
|
|
|
|
|
using NodaTime.Text;
|
|
|
|
|
|
|
|
|
|
namespace PluralKit.Core {
|
|
|
|
|
public class PKMember
|
|
|
|
|
{
|
2020-06-14 19:37:04 +00:00
|
|
|
|
public MemberId Id { get; }
|
2020-06-13 11:06:41 +00:00
|
|
|
|
public string Hid { get; set; }
|
2020-06-14 19:37:04 +00:00
|
|
|
|
public SystemId System { get; set; }
|
2020-06-13 11:06:41 +00:00
|
|
|
|
public string Color { get; set; }
|
|
|
|
|
public string AvatarUrl { get; set; }
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
public string DisplayName { get; set; }
|
|
|
|
|
public LocalDate? Birthday { get; set; }
|
|
|
|
|
public string Pronouns { get; set; }
|
|
|
|
|
public string Description { get; set; }
|
|
|
|
|
public ICollection<ProxyTag> ProxyTags { get; set; }
|
|
|
|
|
public bool KeepProxy { get; set; }
|
2020-06-13 11:11:08 +00:00
|
|
|
|
public Instant Created { get; }
|
|
|
|
|
public int MessageCount { get; }
|
2020-02-12 14:16:19 +00:00
|
|
|
|
|
2020-06-17 19:31:39 +00:00
|
|
|
|
public PrivacyLevel MemberVisibility { get; set; }
|
|
|
|
|
public PrivacyLevel DescriptionPrivacy { get; set; }
|
|
|
|
|
public PrivacyLevel NamePrivacy { get; set; } //ignore setting if no display name is set
|
|
|
|
|
public PrivacyLevel BirthdayPrivacy { get; set; }
|
|
|
|
|
public PrivacyLevel PronounPrivacy { get; set; }
|
|
|
|
|
public PrivacyLevel MetadataPrivacy { get; set; }
|
2020-06-17 19:51:40 +00:00
|
|
|
|
// public PrivacyLevel ColorPrivacy { get; set; }
|
|
|
|
|
|
2020-02-12 14:16:19 +00:00
|
|
|
|
/// Returns a formatted string representing the member's birthday, taking into account that a year of "0001" or "0004" is hidden
|
|
|
|
|
/// Before Feb 10 2020, the sentinel year was 0001, now it is 0004.
|
|
|
|
|
[JsonIgnore] public string BirthdayString
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (Birthday == null) return null;
|
|
|
|
|
|
|
|
|
|
var format = LocalDatePattern.CreateWithInvariantCulture("MMM dd, yyyy");
|
|
|
|
|
if (Birthday?.Year == 1 || Birthday?.Year == 4) format = LocalDatePattern.CreateWithInvariantCulture("MMM dd");
|
|
|
|
|
return format.Format(Birthday.Value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[JsonIgnore] public bool HasProxyTags => ProxyTags.Count > 0;
|
|
|
|
|
}
|
|
|
|
|
}
|