using JiShe.CollectBus.Common.Enums;
using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities;

namespace JiShe.CollectBus.IotSystems.LogRecord
{
    /// <summary>
    /// 日志记录集合
    /// </summary>
    public class LogRecords : AggregateRoot<Guid>
    {
        /// <summary>
        /// 集中器地址
        /// </summary>
        public string Code { get; set; } = null!;

        /// <summary>
        /// AFN功能码
        /// </summary>
        public int AFN { get; set; }

        /// <summary>
        /// 信息点
        /// </summary>
        public int Pn { get; set; }

        /// <summary>
        /// 信息类
        /// </summary>
        public int Fn { get; set; }

        /// <summary>
        /// 主站地址 MSA
        /// </summary>
        public int MSA { get; set; }

        /// <summary>
        /// 响应帧序号
        /// </summary>
        public int PSEQ { get; set; }

        /// <summary>
        /// 响应帧
        /// </summary>
        public string? ReceivedHexMessage { get; set; } = null;

        /// <summary>
        /// 发送帧
        /// </summary>
        public string? SendHexMessage { get; set; } = null;

        /// <summary>
        /// 消息ID
        /// </summary>
        public string? MessageId { get; set; }

        /// <summary>
        /// 消息时间
        /// </summary>
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime? ReceivedTime { get; set; }

        /// <summary>
        /// 采集密度
        /// </summary>
        public int TimeDensity { get; set; }

        /// <summary>
        /// 采集密度单位
        /// </summary>
        public DensityUnit DensityUnit { get; set; } = DensityUnit.None;

        /// <summary>
        /// 项目ID
        /// </summary>
        public int ProjectId { get; set; }

        /// <summary>
        /// 集中器ID
        /// </summary>
        public int FocusId { get; set; }

        /// <summary>
        /// 数据
        /// </summary>
        //public object? Data { get; set;}

        /// <summary>
        /// 创建时间
        /// </summary>
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime CreationTime { get; set; }=DateTime.Now;
    }
}
