namespace slskd.API.DTO
{
using System;
using slskd.Entities;
public class RoomMessageResponse
{
///
/// The timestamp of the message.
///
public DateTime Timestamp { get; set; } = DateTime.UtcNow;
///
/// The username of the user who sent the message.
///
public string Username { get; set; }
///
/// The message.
///
public string Message { get; set; }
///
/// The room to which the message pertains.
///
public string RoomName { get; set; }
///
/// A value indicating whether this user data belongs to the currently logged in user.
///
public bool? Self { get; set; }
public static RoomMessageResponse FromRoomMessage(RoomMessage roomMessage, bool self = false)
{
return new RoomMessageResponse()
{
Timestamp = roomMessage.Timestamp,
Username = roomMessage.Username,
Message = roomMessage.Message,
RoomName = roomMessage.RoomName,
Self = self ? self : (bool?)null
};
}
}
}