using System; namespace Gameboard.ShogiUI.Sockets.Repositories.CouchModels { public class UserDocument : CouchDocument { public enum LoginPlatform { Microsoft, Guest } public string Name { get; set; } public LoginPlatform Platform { get; set; } /// /// The browser session ID saved via Set-Cookie headers. /// Only used with guest accounts. /// public Guid? WebSessionId { get; set; } /// /// Constructor for JSON deserializing. /// public UserDocument() : base(WhichDocumentType.User) { Name = string.Empty; } public UserDocument(string name, Guid? webSessionId = null) : base($"org.couchdb.user:{name}", WhichDocumentType.User) { Name = name; WebSessionId = webSessionId; Platform = WebSessionId.HasValue ? LoginPlatform.Guest : LoginPlatform.Microsoft; } } }