using MessagePack;

namespace MareSynchronos.API.Data;

[MessagePackObject(keyAsPropertyName: true)]
public record SignedChatMessage(ChatMessage Message, UserData Sender) : ChatMessage(Message)
{
    // Sender and timestamp are set by the server
    public UserData Sender { get; set; } = Sender;
    public long Timestamp { get; set; } = 0;
    // Signature is generated by the server as SHA256(Sender.UID | Timestamp | Destination | Message)
    // Where Destination is either the receiver's UID, or the group GID
    public string Signature { get; set; } = string.Empty;
}