using Hotline.Settings;

namespace Hotline.Share.Dtos.Order
{

    public class DepartmentAcceptanceTypeStatisticsDto
    {
        /// <summary>
        /// 部门名称
        /// </summary>
        public string OrgName { get; set; }
        public string OrgCode { get; set; }

        /// <summary>
        /// 部门类型
        /// </summary>
        public string OrgType { get; set; }

        /// <summary>
        /// 总量
        /// </summary>
        public int AllCount => ZxAllCount + JyAllCount + QzAllCount + ByAllCount + JbAllCount + TsAllCount + QtAllCount;
        public double? AllTimes => Math.Round(ZxAllTimes.Value + JyAllTimes.Value + QzAllTimes.Value + ByAllTimes.Value + JbAllTimes.Value + TsAllTimes.Value + QtAllTimes.Value, 2);
        public double? AverageTime => GetCalculateAverage(AllCount, AllTimes);
       public string? AcceptanceTypeCode { get; set; }

        /// <summary>
        /// 咨询
        /// </summary>
        public int ZxAllCount { get; set; }
        public double? ZxAllTimes { get; set; }
        public double? ZxAverageTime => GetCalculateAverage(ZxAllCount, ZxAllTimes);
        public string? ZxAcceptanceTypeCode { get; set; }

        /// <summary>
        /// 建议
        /// </summary>
        public int JyAllCount { get; set; }
        public double? JyAllTimes { get; set; }
        public double? JyAverageTime => GetCalculateAverage(JyAllCount, JyAllTimes);
        public string? JyAcceptanceTypeCode { get; set; }

        /// <summary>
        /// 求助
        /// </summary>
        public int QzAllCount { get; set; }
        public double? QzAllTimes { get; set; }
        public double? QzAverageTime => GetCalculateAverage(QzAllCount, QzAllTimes);
        public string? QzAcceptanceTypeCode { get; set; }

        /// <summary>
        /// 表扬
        /// </summary>
        public int ByAllCount { get; set; }
        public double? ByAllTimes { get; set; }
        public double? ByAverageTime => GetCalculateAverage(ByAllCount, ByAllTimes);
        public string? ByAcceptanceTypeCode { get; set; }

        /// <summary>
        /// 举报
        /// </summary>
        public int JbAllCount { get; set; }
        public double? JbAllTimes { get; set; }
        public double? JbAverageTime => GetCalculateAverage(JbAllCount, JbAllTimes);
        public string? JbAcceptanceTypeCode { get; set; }

        /// <summary>
        /// 投诉
        /// </summary>
        public int TsAllCount { get; set; }
        public double? TsAllTimes { get; set; }
        public double? TsAverageTime => GetCalculateAverage(TsAllCount, TsAllTimes);
        public string? TsAcceptanceTypeCode { get; set; }

        /// <summary>
        /// 其他
        /// </summary>
        public int QtAllCount { get; set; }
        public double? QtAllTimes { get; set; }
        public double? QtAverageTime => GetCalculateAverage(QtAllCount, QtAllTimes);
        public string? QtAcceptanceTypeCode { get; set; }

        /// <summary>
        /// 意见
        /// </summary>
        public int YjAllCount { get; set; }
        public double? YjAllTimes { get; set; }
        public double? YjAverageTime => GetCalculateAverage(YjAllCount, YjAllTimes);
        public string? YjAcceptanceTypeCode { get; set; }

        /// <summary>
        /// 计算平均
        /// </summary>
        /// <param name="count"></param>
        /// <param name="Times"></param>
        /// <returns></returns>
        public double GetCalculateAverage(int count, double? Times)
        {
            if (count != 0 && Times != null && Times != 0)
            {
                return Math.Round((Times.Value / (double)count), 2);
            }
            return 0;
        }
    }

    public class DepartmentAcceptanceTypeStatisticsV1Dto
    {
        /// <summary>
        /// 部门名称
        /// </summary>
        public string OrgName { get; set; }
        public string OrgCode { get; set; }

        /// <summary>
        /// 部门类型
        /// </summary>
        public EOrgType OrgType { get; set; }
        public string OrgTypeText { get; set; }

        /// <summary>
        /// 总量
        /// </summary>
        public int AllCount => ZxAllCount + JyAllCount + QzAllCount + ByAllCount + JbAllCount + TsAllCount + QtAllCount;
        public string? AcceptanceTypeCode { get; set; }

        /// <summary>
        /// 咨询
        /// </summary>
        public int ZxAllCount { get; set; }
        public string? ZxAcceptanceTypeCode { get; set; }

        /// <summary>
        /// 建议
        /// </summary>
        public int JyAllCount { get; set; }
        public string? JyAcceptanceTypeCode { get; set; }

        /// <summary>
        /// 求助
        /// </summary>
        public int QzAllCount { get; set; }
        public string? QzAcceptanceTypeCode { get; set; }

        /// <summary>
        /// 表扬
        /// </summary>
        public int ByAllCount { get; set; }
        public string? ByAcceptanceTypeCode { get; set; }

        /// <summary>
        /// 举报
        /// </summary>
        public int JbAllCount { get; set; }
        public string? JbAcceptanceTypeCode { get; set; }

        /// <summary>
        /// 投诉
        /// </summary>
        public int TsAllCount { get; set; }
        public string? TsAcceptanceTypeCode { get; set; }

        /// <summary>
        /// 其他
        /// </summary>
        public int QtAllCount { get; set; }
        public string? QtAcceptanceTypeCode { get; set; }

        /// <summary>
        /// 意见
        /// </summary>
        public int YjAllCount { get; set; }
        public string? YjAcceptanceTypeCode { get; set; }

        /// <summary>
        /// 惠民帮助
        /// </summary>
        public int HmAllCount { get; set; }
        public string? HmAcceptanceTypeCode { get; set; }

        /// <summary>
        /// 大气污染举报
        /// </summary>
        public int DqAllCount { get; set; }
        public string? DqAcceptanceTypeCode { get; set; }
    }
}
