namespace DataSharing.Share.Dtos.HotlineWeb
{
    public class CalculateUploadRateDto
    {
        /// <summary>
        /// 工单总量
        /// </summary>
        public int OrderCountNum { get; set; }

        /// <summary>
        /// 办结件数
        /// </summary>
        public int HandleEndOrderNum { get; set; }

        /// <summary>
        ///按时办结数量
        /// </summary>
        public int HandleEndOrderOnTime { get; set; }

        /// <summary>
        /// 工单及时上传
        /// </summary>
        public int OrderTimely { get; set; }

        /// <summary>
        /// 工单未及时上传
        /// </summary>
        public int OrderNotTimely { get; set; }

        /// <summary>
        /// 工单及时率
        /// </summary>
        public double OrderTimelinessRate => CalcRate(OrderCountNum, OrderTimely);

        /// <summary>
        /// 办结率
        /// </summary>
        public double HandleEndOrderRate => CalcRate(OrderCountNum, HandleEndOrderNum);

        /// <summary>
        /// 按时办结率
        /// </summary>
        public double HandleEndOrderOnTimeRate => CalcRate(HandleEndOrderNum, HandleEndOrderOnTime);

        /// <summary>
        /// 电话总量
        /// </summary>
        public int TelCountNum { get; set; }

        /// <summary>
        /// 电话接通数
        /// </summary>
        public int TelConnectCountNum { get; set; }

        /// <summary>
        /// 电话未接通数
        /// </summary>
        public int TelNotConnectCountNum { get; set; }

        /// <summary>
        /// 电话及时上传
        /// </summary>
        public int TelTimely { get; set; }

        /// <summary>
        /// 电话未及时上传
        /// </summary>
        public int TelNotTimely { get; set; }

        /// <summary>
        /// 电话及时率
        /// </summary>
        public double TelTimelinessRate => CalcRate(TelCountNum, TelTimely);

        /// <summary>
        /// 电话接通率
        /// </summary>
        public double TelConnectRate => CalcRate(TelCountNum, TelConnectCountNum);

        /// <summary>
        /// 电话来源工单数量
        /// </summary>
        public int RGDHOrderCount { get; set; }

        /// <summary>
        /// 匹配通话记录数
        /// </summary>
        public int ContainTel { get; set; }

        /// <summary>
        /// 未匹配通话记录数
        /// </summary>
        public int NotContainTel { get; set; }

        /// <summary>
        /// 匹配率
        /// </summary>
        public double MatchingRate => CalcRate(RGDHOrderCount, ContainTel);

        /// <summary>
        /// 回访总量
        /// </summary>
        public int VisitCountNum { get; set; }

        /// <summary>
        /// 满意总量
        /// </summary>
        public int SatisfactionCountNum { get; set; }

        /// <summary>
        /// 不满意总量
        /// </summary>
        public int NotSatisfiedCountNum { get; set; }

        /// <summary>
        /// 满意率
        /// </summary>
        public double SatisfactionRate => CalcRate(VisitCountNum, SatisfactionCountNum);

        /// <summary>
        /// 不满意率
        /// </summary>
        public double NotSatisfiedRate => CalcRate(VisitCountNum, NotSatisfiedCountNum);

        /// <summary>
        /// 知识库总量
        /// </summary>
        public int KnowledgeCount { get; set; }

        /// <summary>
        /// 更新知识库量
        /// </summary>
        public int UpdateKnowledgeCount { get; set; }

        /// <summary>
        /// 计算率
        /// </summary>
        /// <param name="CountNum">总量</param>
        /// <param name="Num">数量</param>
        /// <returns></returns>
        public double CalcRate(int CountNum, int Num)
        {
            if (CountNum != 0 && Num != 0)
            {
                return Math.Round((Num / (double)CountNum) * 100, 2);
            }
            return 0;
        }

    }
}
