using System.Net.Http.Headers; using System.Text.Json; using System.Text.Json.Serialization; using Confluent.Kafka; namespace Kafka.Lib.Auth; public class UserChangeMessageType : IMessageType { private string? _userId; private Dictionary _changes = new Dictionary(); private string? _id; private readonly string _eventType = "NewUser"; public string? UserId { get => _userId; set => _userId = value; } public Dictionary Changes { get => _changes; set => _changes = value; } public string? Id { get => _id; set => _id = value; } public string EventType => _eventType; [JsonIgnore] public string Text { get => JsonSerializer.Serialize(this); set { var val = JsonSerializer.Deserialize(value); if (val == null) throw new MessageNullException(); _changes = val.Changes; _userId = val.UserId; _id = val.Id; } } }