
using System.ComponentModel.DataAnnotations;
using JiShe.CollectBus.Common.Enums;

namespace JiShe.CollectBus.Common.Models
{
    public class ReqParameter
    {
        public AFN AFN { get; set; }

        //功能码
        public int FunCode { get; set; }

        public PRM PRM { get; set; } = PRM.启动站报文;

        [Required]
        public string A { get; set; }

        [Required]
        public  Seq Seq { get; set; }

        public int MSA { get; set; } = 0;
    }

    public class ReqParameter2 : ReqParameter
    {
        public int Pn { get; set; }
        public int Fn { get; set; }
    }

    public class AmmeterParameter
    {
        /// <summary>
        /// 电能表/交流采样装置序号
        /// </summary>
        public int SerialNumber { get; set; }
        /// <summary>
        /// 测量点号 0~2040 为0被删除
        /// </summary>
        public int Pn { get; set; }

        /// <summary>
        /// 波特率600起 1~7
        /// </summary>
        public int BaudRate { get; set; }

        /// <summary>
        /// 端口号 1-31
        /// </summary>
        public int Port { get; set; }

        public int ProtocolType { get; set; }
        //public CommunicationProtocolType ProtocolType { get; set; }
        /// <summary>
        /// 通信地址 0~999999999999
        /// </summary>
        public string Address { get; set; }

        /// <summary>
        /// 通信密码
        /// </summary>
        public string Password { get; set; } = "000000";

        /// <summary>
        /// 电能费率个数 1~12
        /// </summary>
        public int RateNumber { get; set; }

        /// <summary>
        /// 整数位个数 0~3 对应4~7位整数
        /// </summary>
        public int IntegerBitNumber { get; set; }

        /// <summary>
        /// 小数位个数0~3 对应1~4位小数
        /// </summary>
        public int DecimalBitNumber { get; set; }

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

        /// <summary>
        /// 用户大类号 0~15
        /// </summary>
        public int UserCategoryNumber { get; set; }

        /// <summary>
        /// 用户小类号 0~15
        /// </summary>
        public int UserSubclassNumber { get; set; }
    }

    public class WaterMeterParameter
    {
        /// <summary>
        /// 测量点号 0~2040 为0被删除
        /// </summary>
        public int Pn { get; set; }

        /// <summary>
        /// 波特率600起 1~7
        /// </summary>
        public int BaudRate { get; set; }

        /// <summary>
        /// 端口号 1-31
        /// </summary>
        public int Port { get; set; }

        public CommunicationProtocolType ProtocolType { get; set; }
        /// <summary>
        /// 通信地址 0~999999999999
        /// </summary>
        public string Address { get; set; }

        /// <summary>
        /// 通信密码
        /// </summary>
        public string Password { get; set; } = "000000";

        /// <summary>
        /// 费率个数
        /// </summary>
        public int RateNumber { get; set; }

        /// <summary>
        /// 整数位个数 0~3 对应4~7位整数
        /// </summary>
        public int IntegerBitNumber { get; set; }

        /// <summary>
        /// 小数位个数0~3 对应1~4位小数
        /// </summary>
        public int DecimalBitNumber { get; set; }

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

        /// <summary>
        /// 用户大类号 0~15
        /// </summary>
        public int UserCategoryNumber { get; set; }

        /// <summary>
        /// 用户小类号 0~15
        /// </summary>
        public int UserSubclassNumber { get; set; }
    }

    public class TimeSetDetail
    {
        public int[] Months { get; set; }
        public List<MutileRateDetail> Data { get; set; }
    }

    public class MutileRateDetail
    {
        public string Rate { get; set; }
        public List<Times> Times { get; set; }
    }

    public class Times
    {
        public string StartTime { get; set; }
        public string EndTime { get; set; }
    }

    public class PnFn
    {
        public int Pn { get; set; }
        public int Fn { get; set; }

        public PnFn(int pn, int fn)
        {
            Pn = pn;
            Fn = fn;
        }
    }

}
