//
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
//
namespace MUnique.OpenMU.ChatServer;
///
/// Type of the chat room client update message.
///
public enum ChatRoomClientUpdateType : byte
{
///
/// A client joined the chat room. Then the client which receives the message adds this client to it's local chat room client list.
///
Joined = 0,
///
/// A client left the chat room. Then the client which receives the message removes this client from it's local chat room client list.
///
Left = 1,
}
///
/// Interface for a chat client.
///
public interface IChatClient
{
///
/// Gets or sets the index of the client in the room.
///
byte Index { get; set; }
///
/// Gets the authentication token which was sent by the client.
///
string? AuthenticationToken { get; }
///
/// Gets or sets the nickname.
///
string? Nickname { get; set; }
///
/// Gets the last activity.
///
DateTime LastActivity { get; }
///
/// Logs the chat client off, which means it removes it from it's current chat room and closes the connection.
///
ValueTask LogOffAsync();
///
/// Sends the message to this chat client.
///
/// The sender identifier.
/// The message.
ValueTask SendMessageAsync(byte senderId, string message);
///
/// Sends the client list of the chat room to this client.
///
/// The chat room clients.
ValueTask SendChatRoomClientListAsync(IReadOnlyCollection clients);
///
/// Notifies the client that another client has joined the chat room.
///
/// The joined client identifier.
/// Name of the joined client.
/// Type of the update (join or leave).
ValueTask SendChatRoomClientUpdateAsync(byte updatedClientId, string updatedClientName, ChatRoomClientUpdateType updateType);
}