using Hotline.Share.Dtos.Order;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Hotline.Share.Dtos.Quality
{
	public class BiQualityDto
	{
	}

	public class SeatsQualityAnalyseDto {

		/// <summary>
		///  工单
		/// </summary>
		public OrderDto? Order { get; set; }

		/// <summary>
		/// 受理人名称
		/// </summary>
		public string? AcceptorName => Order.AcceptorName;

		/// <summary>
		/// 工单编码
		/// </summary>
		public string? No => Order.No;

		/// <summary>
		///  质检明细
		/// </summary>
		public List<QualityDetailDto>? QualityDetails { get; set; }

		/// <summary>
		/// 质检项
		/// </summary>
		public string? QualityDetail => QualityDetails != null && QualityDetails.Any() ? string.Join(";", QualityDetails.Select(x => x.Name)) : string.Empty;


		/// <summary>
		/// 质检分数
		/// </summary>
		public int? Grade { get; set; }
	}


	public class QualityOrderOverviewDto 
	{
		/// <summary>
		/// 质检项
		/// </summary>
		public string? QualityItem { get; set; }

		/// <summary>
		/// 质检工单数
		/// </summary>
		public int OrderNum { get; set; }

		/// <summary>
		/// 全量质检工单数
		/// </summary>
		public int AllOrderNum { get; set; }

		/// <summary>
		/// 占比
		/// </summary>
		public string? Rate => GetRate();

		/// <summary>
		/// 计算占比
		/// </summary>
		/// <returns></returns>
		public string GetRate()
		{
			if (OrderNum != 0 && AllOrderNum != 0)
			{
				return Math.Round((OrderNum / (double)AllOrderNum) * 100, 2) + "%";
			}
			return "0%";
		}

	}


	public class SeatsQualityGradeAnalyseDto 
	{
		public int NinetyGrade { get; set; }

		public int EightyGrade { get; set; }

		public int SeventyGrade { get; set; }

		public int SixtyGrade { get; set; }

		public int FiftyGrade { get; set; }
	}

	public class MonthQualityGradeDto
	{
		public string Month { get; set; }

		public int Num { get; set; }
	}



}
