using JiShe.CollectBus.Common.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Entities.Auditing;

namespace JiShe.CollectBus.IotSystems.MeterReadingRecords
{
    /// <summary>
    /// 抄读任务数据记录
    /// </summary>
    public class MeterReadingRecords : AggregateRoot<Guid>
    {  
        /// <summary>
        /// 是否手动操作
        /// </summary>
        public bool ManualOrNot { get; set; }

        /// <summary>
        /// 任务数据唯一标记
        /// </summary>
        public string TaskMark { get; set; }

        /// <summary>
        /// 时间戳标记，IoTDB时间列处理，上报通过构建标记获取唯一标记匹配时间戳。
        /// </summary>
        public long Timestamps { get; set; }

        /// <summary>
        /// 是否超时
        /// </summary>
        public bool IsTimeout { get; set; } = false;

        /// <summary>
        /// 待抄读时间
        /// </summary>
        public DateTime PendingCopyReadTime { get; set; }
         
        /// <summary>
        /// 集中器ID
        /// </summary>
        public int FocusID { get; set; }

        /// <summary>
        /// 集中器地址
        /// </summary>
        public string FocusAddress { get; set; }

        /// <summary>
        /// 表Id
        /// </summary>
        public int MeterId { get; set; }

        /// <summary>
        /// 表地址
        /// </summary>
        public string MeterAddress { get; set; }

        /// <summary>
        /// 表类型
        /// </summary>
        public MeterTypeEnum MeterType { get; set; }

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

        /// <summary>
        /// 数据库业务ID
        /// </summary>
        public int DatabaseBusiID { get; set; }

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

        /// <summary>
        /// 抄读功能码
        /// </summary>
        public int Fn { get; set; }

        /// <summary>
        /// 抄读计量点
        /// </summary>
        public int Pn { get; set; }

        /// <summary>
        /// 采集项编码
        /// </summary>
        public string ItemCode { get; set;}
         

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreationTime { get; set; }

        /// <summary>
        /// 下发消息内容
        /// </summary>
        public string IssuedMessageHexString { get; set; }

        /// <summary>
        /// 下发消息Id
        /// </summary>
        public string IssuedMessageId { get; set; }

        /// <summary>
        /// 消息上报内容
        /// </summary>
        public string? ReceivedMessageHexString { get; set; }

        /// <summary>
        /// 消息上报时间
        /// </summary>
        public DateTime? ReceivedTime { get; set; }

        /// <summary>
        /// 上报消息Id
        /// </summary>
        public string ReceivedMessageId { get; set; } 

        /// <summary>
        /// 上报报文解析备注，异常情况下才有
        /// </summary>
        public string ReceivedRemark { get; set; }
         
        public void CreateDataId(Guid Id)
        {
            this.Id = Id;
        }
    }
}
