
using Hotline.Share.Dtos.Order;

namespace Hotline.Share.Dtos.Bigscreen
{
    public class OrderStatisticsDto
    {
        /// <summary>
        /// 办结数
        /// </summary>
        public int CompletionCount { get; set; }
        /// <summary>
        /// 办结率
        /// </summary>
        public double CompletionRate { get; set; }

        /// <summary>
        /// 待受理
        /// </summary>
        public int HaveToAcceptCount { get; set; }

        /// <summary>
        /// 待受理率
        /// </summary>
        public double HaveToAcceptRate { get; set; }

        /// <summary>
        /// 超期工单数
        /// </summary>
        public int OverTimeCount { get; set; }

        /// <summary>
        /// 超期率
        /// </summary>
        public double OverTimeRate { get; set; }

        /// <summary>
        /// 延期工单数
        /// </summary>
        public int DelayCount { get; set; }

        /// <summary>
        /// 延期率
        /// </summary>
        public double DelayRate { get; set; }

        /// <summary>
        /// 满意工单数
        /// </summary>
        public int SatisfiedCount { get; set; }

        /// <summary>
        /// 满意率
        /// </summary>
        public double SatisfiedRate { get; set; }

        /// <summary>
        /// 省工单量
        /// </summary>
        public int ProvinceOrderCount { get; set; }

        /// <summary>
        /// 省工单办结
        /// </summary>
        public int ProvinceOrderCompletionCount { get; set; }
    }

    public class KnowledgeStatisticsDto
    {
        public int TodayAddCount { get; set; }

        public int ThisMonthModifyCount { get; set; }

        public int TodayReadCount { get; set; }

        public int KnowledgeCount { get; set; }
    }

    public class OrderTypeHandleStatisticsDto
    {
        public string AcceptType { get; set; }

        public int SumCount { get; set; }

        public int HandlingCount { get; set; }

        public int FiledCount { get; set; }

        public int OverTimeCount { get; set; }
    }

    public class EarlyWarningHotsPotsStatisticsDto
    {
        public string HotspotId { get; set; }

        public string HotspotName { get; set; }

        public int SumCount { get; set; }

        public string HotspotSpliceName { get; set; }
    }

    public class OrderCountStatisticsDto
    {
        public int ToDayCount { get; set; }

        public double ToDayQoQ { get; set; }

        public int ToMonthCount { get; set; }

        public double ToMonthQoQ { get; set; }

        public int ToYearCount { get; set; }

        public double ToYearQoQ { get; set; }
    }

    public class OrderAreaAcceptStatisticsDto
    {
        public string AreaCode { get; set; }
        public string AreaName { get; set; }

        public int AcceptedCount { get; set; }

        public int CompletionCount { get; set; }

        public double CompletionRate => CalcCompletion();

        public double CalcCompletion()
        {
            if (CompletionCount == 0 || AcceptedCount == 0)
            {
                return 0;
            }
            return Math.Round((CompletionCount / (double)AcceptedCount) * 100, 2);
        }

    }

    public class OrderAreaAcceptQueryDto
    {
        public int HandlingCount { get; set; }

        public int FiledCount { get; set; }

        public int OverTimeCount { get; set; }

        public string HotspotName { get; set; }

        public string AreaCode { get; set; }

        public string AreaName { get; set; }

        public double SatisfiedRate { get; set; }
    }

    public class HighFrequencyCallStatisticsDto
    {
        public string Callnum { get; set; }

        public int OrderCountNum { get; set; }
    }

    public class HighMatterWarningDto
    {
        public string AreaName { get; set; }

        public string Title { get; set; }

        public string HotspotName { get; set; }

        public string HotspotId { get; set; }

        public int SumCount { get; set; }

        public string Id { get; set; }

        public string AcceptTypeCode { get; set; }

        public string AcceptType { get; set; }

        public string AreaCode { get; set; }
    }

    public class OrderVisitOrgSatisfactionRankDto
    {
        public string VisitOrgCode { get; set; }

        public string VisitOrgName { get; set; }

        public int SatisfiedCount { get; set; }

        public int VisitCount { get; set; }

        public double SatisfiedRate => CalcSatisfiedRate();

        public double CalcSatisfiedRate()
        {
            if (SatisfiedCount == 0 || VisitCount == 0)
            {
                return 0;
            }
            return Math.Round((SatisfiedCount / (double)VisitCount) * 100, 2);
        }
    }

    public class OrderSourceAndAcceptTtoeStatisticsDto
    {
        public string Name { get; set; }

        public int SumCount { get; set; }

        public int HasCount { get; set; }

        public double HasRate => CalcHasRate();

        public double CalcHasRate()
        {
            if (HasCount == 0 || SumCount == 0)
            {
                return 0;
            }
            return Math.Round((HasCount / (double)SumCount) * 100, 2);
        }
    }

    /// <summary>
    /// 二次办理统计
    /// </summary>
    public class SecondaryProcessingOrderStatisticsDto
    {
        /// <summary>
        /// 二次办理工单
        /// </summary>
        public int OrderCount { get; set; }

        /// <summary>
        /// 二次办理超期
        /// </summary>
        public int OrderOverdueCount { get; set; }

        /// <summary>
        /// 二次办理即将超期
        /// </summary>
        public int OrderSoonOverdueCount { get; set; }

        /// <summary>
        /// 二次办理满意率
        /// </summary>
        public string SatisfactionRate { get; set; }
    }

    public class SecondarySatisfactionDto
    {
        public int Count { get; set; }

        public int NoSatisfiedCount { get; set; }

        /// <summary>
        /// 满意率
        /// </summary>
        public string SatisfiedRate => CalcSatisfiedRate();

        public string CalcSatisfiedRate()
        {
            if (Count == 0)
            {
                return "0.000%";
            }
            return Math.Round(((Count - NoSatisfiedCount) / (double)Count) * 100, 3) + "%";
        }
    }

}
