Files
Shogi/Gameboard.ShogiUI.Sockets/Models/SessionMetadata.cs
2021-08-01 17:32:43 -05:00

36 lines
927 B
C#

namespace Gameboard.ShogiUI.Sockets.Models
{
/// <summary>
/// A representation of a Session without the board and game-rules.
/// </summary>
public class SessionMetadata
{
public string Name { get; }
public string Player1 { get; }
public string? Player2 { get; private set; }
public bool IsPrivate { get; }
public SessionMetadata(string name, bool isPrivate, string player1, string? player2)
{
Name = name;
IsPrivate = isPrivate;
Player1 = player1;
Player2 = player2;
}
public SessionMetadata(Session sessionModel)
{
Name = sessionModel.Name;
IsPrivate = sessionModel.IsPrivate;
Player1 = sessionModel.Player1;
Player2 = sessionModel.Player2;
}
public void SetPlayer2(string playerName)
{
Player2 = playerName;
}
public ServiceModels.Types.Game ToServiceModel() => new(Name, Player1, Player2);
}
}