45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace Gameboard.ShogiUI.Sockets.Repositories.CouchModels
|
|
{
|
|
public class SessionDocument : CouchDocument
|
|
{
|
|
public string Name { get; set; }
|
|
public string Player1Id { get; set; }
|
|
public string? Player2Id { get; set; }
|
|
public bool IsPrivate { get; set; }
|
|
public IList<BoardStateDocument> History { get; set; }
|
|
|
|
/// <summary>
|
|
/// Default constructor and setters are for deserialization.
|
|
/// </summary>
|
|
public SessionDocument() : base(WhichDocumentType.Session)
|
|
{
|
|
Name = string.Empty;
|
|
Player1Id = string.Empty;
|
|
Player2Id = string.Empty;
|
|
History = new List<BoardStateDocument>(0);
|
|
}
|
|
|
|
public SessionDocument(Models.Session session)
|
|
: base(session.Name, WhichDocumentType.Session)
|
|
{
|
|
Name = session.Name;
|
|
Player1Id = session.Player1.Id;
|
|
Player2Id = session.Player2?.Id;
|
|
IsPrivate = session.IsPrivate;
|
|
History = new List<BoardStateDocument>(0);
|
|
}
|
|
|
|
public SessionDocument(Models.SessionMetadata sessionMetaData)
|
|
: base(sessionMetaData.Name, WhichDocumentType.Session)
|
|
{
|
|
Name = sessionMetaData.Name;
|
|
Player1Id = sessionMetaData.Player1.Id;
|
|
Player2Id = sessionMetaData.Player2?.Id;
|
|
IsPrivate = sessionMetaData.IsPrivate;
|
|
History = new List<BoardStateDocument>(0);
|
|
}
|
|
}
|
|
}
|