using System;
using FreeSql.DataAnnotations;

namespace JiShe.CollectBus.EnergySystems.Entities
{
    public class TB_AmmeterInfo
    {

        /// <summary>
        /// 电表信息
        /// </summary>		
        public int ID { get; set; }

        /// <summary>
        /// 电表编号、电表型号
        /// </summary>		
        public string Code { get; set; }

        /// <summary>
        /// 区域信息外键
        /// </summary>
        public int AreaID { get; set; }
        /// <summary>
        /// 区域名
        /// </summary>
        [Column(IsIgnore = true)]
        public string AreaName { get; set; }

        /// <summary>
        /// 电表别名
        /// </summary>		
        public string Name { get; set; }

        /// <summary>
        /// 电表类别 （1单相、2三相三线、3三相四线）
        /// </summary>		
        public int TypeName { get; set; }

        /// <summary>
        /// 电表安装地址
        /// </summary>		
        public string Location { get; set; }
        /// <summary>
        /// 电表安装时间
        /// </summary>
        public DateTime? InstallTime { get; set; }

        /// <summary>
        /// 电表密码
        /// </summary>		
        public string Password { get; set; }

        /// <summary>
        /// 电表通信地址
        /// </summary>		
        public string Address { get; set; }

        /// <summary>
        /// 采集器地址
        /// </summary>
        public string CollectorAddress { get; set; }

        /// <summary>
        /// 电压变比
        /// 电压互感器（PT）
        /// </summary>		
        public double TimesV { get; set; }

        /// <summary>
        /// 电流变比
        /// 电流互感器（CT）
        /// </summary>		
        public double TimesA { get; set; }

        /// <summary>
        /// 是否总表
        /// </summary>
        public int IsSum { get; set; }

        /// <summary>
        /// 总表ID
        /// </summary>
        public int ParentID { get; set; }

        /// <summary>
        /// Explain
        /// </summary>		
        public string Explain { get; set; }

        /// <summary>
        /// AddDate
        /// </summary>	
        public DateTime AddDate { get; set; }

        /// <summary>        
        /// State表状态:    （对应枚举 MeterStateEnum）
        /// 0新装（未下发），1运行(档案下发成功时设置状态值1)， 2暂停, 100销表（销表后是否重新启用）；
        /// 特定State:   -1 已删除
        /// </summary>		
        public int State { get; set; }


        /// <summary>
        /// 费率类型，单、多   (SingleRate :单费率（单相表1），多费率（其他0） ，与TypeName字段无关)  
        /// SingleRate ? "单" : "复"  
        /// [SingleRate]  --0 复费率 false ， 1 单费率 true   （与PayPlanID保持一致）
        ///对应 TB_PayPlan.Type: 1复费率，2单费率
        /// </summary>
        public bool SingleRate { get; set; }

        /// <summary>
        /// 0 未下发 (false), 1 已下发 (true)
        /// </summary>
        public bool IsSend { get; set; }

        /// <summary>
        /// 创建人ID
        /// </summary>
        public int CreateUserID { get; set; }

        /// <summary>
        /// 波特率 default(2400)
        /// </summary>
        public int Baudrate { get; set; }
        /// <summary>
        /// 规约  -电表default(30)
        /// </summary>
        public int? Protocol { get; set; }
        /// <summary>
        /// 一个集中器下的[MeteringCode]必须唯一。
        /// </summary>
        public int MeteringCode { get; set; }
        /// <summary>
        ///  MeteringPort 端口就几个可以枚举。
        /// </summary>
        public int MeteringPort { get; set; }

        /// <summary>
        ///  对应[TB_PayPlan]
        /// </summary>
        public int PayPlanID { get; set; }


        public int ProjectID { get; set; }

        public int FocusID { get; set; }

        /// <summary>
        /// 集中器名称(扩展字段)
        /// </summary>
        [Column(IsIgnore = true)] 
        public string FocusName { get; set; }

        /// <summary>
        /// 跳合闸状态字段：  0 合闸，1 跳闸
        /// 电表：TripState （0 合闸-通电, 1 断开、跳闸）；
        /// </summary>
        public int TripState { get; set; }
        /// <summary>
        /// 最近阀控时间
        /// </summary>
        public DateTime? TripTime { get; set; }

        /// <summary>
        /// 排序字段
        /// </summary>
        public int Sort { get; set; }

        /// <summary>
        /// 电子表0 ，
        /// 机械表1（德力西机械电表-Code）
        /// (原有数据都默认：电子电表)
        /// </summary>
        [Column(IsIgnore = true)]
        public int MeterKind { get; set; }

        /// <summary>
        /// 采集方案ID
        /// </summary>
        [Column(IsIgnore = true)]
        public int GatherPlanID { get; set; }

        /// <summary>
        /// 采集项
        /// </summary>
        public string ReadClass { get; set; }

        /// <summary>
        /// 修改日期
        /// </summary>
        public DateTime? EditDate { get; set; }

        /// <summary>
        /// 修改用ID
        /// </summary>
        public int? EditUserID { get; set; }

        /// <summary>
        /// 删除时间
        /// </summary>
        public DateTime? RemoveDate { get; set; }

        /// <summary>
        /// 删除用户ID
        /// </summary>
        public int? RemoveUserID { get; set; }

        /// <summary>
        /// 掉电状态 (未上电=1，上电掉电中=2)
        /// </summary>
        public int? PowerDownStatus { get; set; }

        /// <summary>
        /// 电流规格
        /// </summary>
        public string CurrentSpec { get; set; }

        /// <summary>
        /// 电压规格
        /// </summary>
        public string VoltageSpec { get; set; }

        /// <summary>
        /// 通讯状态 1：在线 0：离线
        /// </summary>
        public int LineState { get; set; }

        /// <summary>
        /// 特殊表 1：是 0：否
        /// </summary>
        public int Special { get; set; }

        /*
        /// <summary>
        /// 采集项总数
        /// </summary>
        public int GatherTotal { get; set; }

        /// <summary>
        /// 采集项
        /// </summary>
        public string GatherDataTypes { get; set; }
        */

        /// <summary>
        /// 复费率类型（四费率=4，八费率=8）
        /// </summary>
        public int? MultipleRateType { get; set; }
    }

    public class VMAmmeterInfo : TB_AmmeterInfo
    {
        public decimal? Rate { get; set; }
        public decimal? Rate1 { get; set; }
        public decimal? Rate2 { get; set; }
        public decimal? Rate3 { get; set; }

        public decimal? Rate4 { get; set; }

        public decimal? Rate5 { get; set; }

        public decimal? Rate6 { get; set; }
    }
}
