namespace slskd.API.DTO
{
using slskd.Entities;
using System.Collections.Generic;
using System.Linq;
public class RoomResponse
{
///
/// The room name.
///
public string Name { get; set; }
///
/// A value indicating whether the room is private.
///
public bool IsPrivate { get; set; }
///
/// The number of operators in the room, if private.
///
public int? OperatorCount { get; set; }
///
/// The operators in the room, if private.
///
public IList Operators { get; set; }
///
/// The owner of the room, if private.
///
public string Owner { get; set; }
///
/// The list of users in the room.
///
public IEnumerable Users { get; set; } = new List();
///
/// The list of messages.
///
public IEnumerable Messages { get; set; } = new List();
public static RoomResponse FromRoom(Room room)
{
return new RoomResponse()
{
Name = room.Name,
IsPrivate = room.IsPrivate,
OperatorCount = room.OperatorCount,
Operators = room.Operators?.ToList(),
Owner = room.Owner,
Users = new List(),
Messages = new List()
};
}
}
}