using Newtonsoft.Json.Linq; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CoreAgent.ProtocolClient.Models { /// /// 源协议日志模型 /// public record class SourceProtocolLog { /// /// 消息ID /// [JsonProperty("message_id")] public int? MessageId { get; set; } /// /// 消息头信息 /// [JsonProperty("headers")] public string[]? Headers { get; set; } /// /// 消息内容 /// [JsonProperty("message")] public string Message { get; set; } /// /// 时间戳 /// [JsonProperty("time")] public double? Time { get; set; } /// /// 日志明细 /// [JsonProperty("logs")] public JToken? Logs { get; set; } /// /// 初始化源协议日志的新实例 /// public SourceProtocolLog( string message, string? type, string? version, double? time, double? utc, JToken? logs, int? messageId, string[]? headers) { Message = message; Time = time; Logs = logs; MessageId = messageId ?? 0; Headers = headers; } } /// /// 源协议日志明细模型 /// public class SourceProtocolLogDetail { /// /// 源信息 /// [JsonProperty("src")] public string Src { get; set; } /// /// 索引 /// [JsonProperty("idx")] public int Idx { get; set; } /// /// 日志级别 /// [JsonProperty("level")] public int Level { get; set; } /// /// 方向 /// [JsonProperty("dir")] public string Dir { get; set; } /// /// 时间戳 /// [JsonProperty("timestamp")] public long Timestamp { get; set; } /// /// 小区信息 /// [JsonProperty("cell")] public int? Cell { get; set; } /// /// 数据列表 /// [JsonProperty("data")] public List Data { get; set; } /// /// 层信息 /// [JsonProperty("layer")] public string Layer { get; set; } /// /// UE标识 /// [JsonProperty("ue_id")] public int? UeId { get; set; } /// /// 帧信息 /// [JsonProperty("frame")] public int? Frame { get; set; } /// /// 时隙信息 /// [JsonProperty("slot")] public int? Slot { get; set; } /// /// 帧信息 /// [JsonProperty("channel")] public string? Channel { get; set; } /// /// 时隙信息 /// [JsonProperty("rnti")] public int? Rnti { get; set; } /// /// 深拷贝当前对象 /// public SourceProtocolLogDetail DeepClone() { // 通过序列化和反序列化实现深拷贝 var json = JsonConvert.SerializeObject(this); return JsonConvert.DeserializeObject(json) ?? throw new InvalidOperationException("深拷贝失败,反序列化结果为 null"); } } }