using FreeSql.DataAnnotations;
using Newtonsoft.Json;
using System;
using System.ComponentModel;
namespace FreeSql.Tests.ClickHouse
{
    /// 
    /// 实时数据
    /// 
    [Index("idx_{tablename}_01", nameof(Guid), true)]
    [Index("idx_{tablename}_02", nameof(TenantId), true)]
    //复合索引
    [Index("idx_{tablename}_03", $"{nameof(CreatedUserId)},{nameof(Version)}", false)]
    [Table(OldName = "CollectDataEntityUpdate")]
    public partial class CollectDataEntityUpdate01
    {
        /// 
        /// Guid
        /// 
        [Column(StringLength = 50)]
        public string Guid
        {
            get; set;
        }
        /// 
        /// 租户Id
        /// 
        [Description("租户Id")]
        [Column(CanUpdate = false)]
        public virtual long? TenantId
        {
            get; set;
        }
        /// 
        /// 版本
        /// 
        [Description("版本")]
        [Column(IsVersion = false)]
        public long Version
        {
            get; set;
        }
        /// 
        /// 是否删除
        /// 
        [Description("是否删除")]
        [Column()]
        public bool IsDeleted { get; set; } = false;
        /// 
        /// 创建者Id
        /// 
        [Description("创建者Id")]
        [Column(CanUpdate = false)]
        public long? CreatedUserId
        {
            get; set;
        }
        /// 
        /// 创建者
        /// 
        [Description("创建者")]
        [Column(CanUpdate = false, StringLength = 50, OldName = "CreatedUserNameUpdate")]
        public string CreatedUserNameUpdate01
        {
            get; set;
        }
        /// 
        /// 创建时间
        /// 
        [Description("创建时间")]
        [Column(CanUpdate = false, ServerTime = DateTimeKind.Local)]
        public DateTime? CreatedTime
        {
            get; set;
        }
        /// 
        /// 修改者Id
        /// 
        [Description("修改者Id")]
        [Column(CanInsert = false)]
        public long? ModifiedUserId
        {
            get; set;
        }
        /// 
        /// 修改者
        /// 
        [Description("修改者")]
        [Column(CanInsert = false, StringLength = 50)]
        public string ModifiedUserName
        {
            get; set;
        }
        /// 
        /// 修改时间
        /// 
        [Description("修改时间")]
        [Column(CanInsert = false, ServerTime = DateTimeKind.Local)]
        public DateTime? ModifiedTime
        {
            get; set;
        }
        /// 
        /// 数据标识
        /// 
        [Description("数据标识")]
        [Column(CanInsert = false, StringLength = 2)]
        public string DataFlag
        {
            get; set;
        }
        /// 
        /// 主键Id
        /// 
        [Description("主键Id")]
        [Column(Position = 1, IsPrimary = true)]
        public long Id
        {
            get; set;
        }
        /// 
        /// 设备编号
        /// 
        [Column(StringLength = 50)]
        public string EquipmentCode
        {
            get; set;
        }
        /// 
        /// 数据编号,如为空使用默认数据
        /// 
        [Column(StringLength = 50)]
        public string PropertyCode
        {
            get; set;
        }
        /// 
        ///  数据名称,如为空使用默认数据
        /// 
        [Column(StringLength = 50)]
        public string PropertyName
        {
            get; set;
        }
        /// 
        /// 数值或状态是否变更
        /// 
        public bool IsValueOrStateChanged
        {
            get; set;
        }
        /// 
        /// 采集数值
        /// 
        [Column(StringLength = 18)]
        public decimal? NumericValue
        {
            get; set;
        }
        /// 
        /// 备注
        /// 
        [Column(StringLength = 200)]
        public string Remark
        {
            get; set;
        }
        /// 
        /// 服务标记
        /// 
        [Column(StringLength = 20)]
        public string ServiceFlag
        {
            get; set;
        }
        /// 
        /// 状态
        /// 
        [Column(StringLength = 50)]
        public string StrState
        {
            get; set;
        }
        /// 
        /// 文本数值
        /// 
        [Column(StringLength = 50)]
        public string StrValue
        {
            get; set;
        }
        /// 
        /// 单位
        /// 
        [Column(StringLength = 10)]
        public string UnitStr
        {
            get; set;
        }
        /// 
        /// 采集时间
        /// 
        public DateTime CollectTime
        {
            get; set;
        }
        public string FieldKey
        {
            get
            {
                return EquipmentCode + "_" + PropertyCode;
            }
        }
    }
}