using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Hotline.Share.Dtos.Quality
{
	public class AiQualityDto
	{
		/// <summary>
		/// 录音来源方式：sftp,ftp,http，nas
		/// </summary>
		public string AudioSource { get; set; } = "http";

		/// <summary>
		/// 工单号：录音的唯一ID
		/// </summary>
		public string RecordID { get; set; }

		/// <summary>
		/// 录音的存储路径：此处录音路径格式与audioSource方式有关
		/// </summary>
		public string RecordPath { get; set; }

		/// <summary>
		/// 坐席工号
		/// </summary>
		public string AgentID { get; set; }

		/// <summary>
		/// 坐席组编号
		/// </summary>
		public string AgentTeamID { get; set; } = "0";

		/// <summary>
		/// 来电号码
		/// </summary>
		public string CallNumber { get; set; }

		/// <summary>
		/// 来电时间，固定格式：yyyy-MM-dd HH:mm:ss
		/// </summary>
		public string CallTime { get; set; }

		/// <summary>
		/// 录音格式
		/// </summary>
		public string RecordForm { get; set; }

		/// <summary>
		/// 采样率
		/// </summary>
		public string SamplingRate { get; set; } = "8k";

		/// <summary>
		/// 编码方式
		/// </summary>
		public string Encoding { get; set; } = "16bit";

		/// <summary>
		/// 声道数(1:单声道，2：双声道)
		/// </summary>
		public string SoundChannel { get; set; } = "2";

		/// <summary>
		/// 坐席对应声道(1:单声道，2：双声道，左声道为坐席，3：双声道，右声道为坐席)
		/// </summary>
		public string AgentChannel { get; set; } = "3";

		/// <summary>
		/// 扩展字段
		/// </summary>
		public string ywlx { get; set; }
	}

	public class AiQualityResultDto : AiQualitySourceData
	{
		public TransData trans_data { get; set; }
	}
	public class AiQualitySourceData : AiQualityAnalysisData
	{
		/// <summary>
		/// 工单号：录音的唯一ID
		/// </summary>
		public string record_id { get; set; }

		/// <summary>
		/// 录音PATH地址
		/// </summary>
		public string record_path { get; set; }

		/// <summary>
		/// 录音URL地址
		/// </summary>
		public string record_url { get; set; }

		/// <summary>
		/// 客户id，全局唯一
		/// </summary>
		public string customer_id { get; set; }

		/// <summary>
		/// 录音文件名称
		/// </summary>
		public string file_name { get; set; }

		/// <summary>
		/// 坐席工号
		/// </summary>
		public string agent_id { get; set; }

		/// <summary>
		/// 坐席组的编号
		/// </summary>
		public string agent_group_no { get; set; }

		/// <summary>
		/// 来电号码
		/// </summary>
		public string call_number { get; set; }

		/// <summary>
		/// 通话的来电时间
		/// </summary>
		public decimal call_time { get; set; }

		/// <summary>
		/// 录音格式，wav、mp3、v3、pcm等
		/// </summary>
		public string record_form { get; set; }

		/// <summary>
		/// 采样率
		/// </summary>
		public string sampling_rate { get; set; }

		/// <summary>
		/// 编码方式
		/// </summary>
		public string encoding { get; set; }

		/// <summary>
		/// 声道数（个）
		/// </summary>
		public int sound_channel { get; set; }

		/// <summary>
		/// 坐席声音存储的声道
		/// </summary>
		public int agent_channel { get; set; }

		/// <summary>
		/// 来电地区
		/// </summary>
		public string region { get; set; }

		/// <summary>
		/// 工单上传时间
		/// </summary>
		public decimal upload_time { get; set; }

		/// <summary>
		/// 来源，1：平台上传；2：接口上传
		/// </summary>
		public string source { get; set; }

		/// <summary>
		/// 文件大小
		/// </summary>
		public string file_size { get; set; }

		/// <summary>
		/// 文件上传时间
		/// </summary>
		public decimal file_upload_time { get; set; }

		public AiQualityExtended extended_field { get; set; }

	}
	public class AiQualityExtended
	{
		public string field11 { get; set; }
	}
	public class AiQualityAnalysisData 
	{
		/// <summary>
		/// 智能质检得分
		/// </summary>
		public int quality_score { get; set; }

		/// <summary>
		/// 智能质检时间
		/// </summary>
		public decimal quality_time { get; set; }

		/// <summary>
		/// 是否减分[1是0否]
		/// </summary>
		public int reduction_flag { get; set; }

		/// <summary>
		/// 智能质检策略名称
		/// </summary>
		public string strategy_name { get; set; }

		/// <summary>
		/// 智能质检评分规则名称
		/// </summary>
		public string score_name { get; set; }

		public List<AiQualityScoreItems> score_items { get; set; }
	}
	public class AiQualityScoreItems 
	{
		/// <summary>
		/// 智能评分项名称
		/// </summary>
		public string name { get; set; }

		/// <summary>
		/// 质检方式，1：质检规则；2：智能分类器；
		/// </summary>
		public int type { get; set; }

		/// <summary>
		/// 出现个数
		/// </summary>
		public string num { get; set; }

		/// <summary>
		/// 出现次数
		/// </summary>
		public int times { get; set; }

		/// <summary>
		/// 评分项说明
		/// </summary>
		public string description { get; set; }

		/// <summary>
		/// 分值类型，0：减分；1：加分
		/// </summary>
		public int score_type { get; set; }

		/// <summary>
		/// 分值
		/// </summary>
		public int score { get; set; }

		/// <summary>
		/// 评分项结果评分
		/// </summary>
		public int result_score { get; set; }

		/// <summary>
		/// 质检模型信息
		/// </summary>
		public List<QualityModels> qualityModels { get; set; }

		public List<AudioAttributes> audioAttributes { get; set; }
	}
	public class AudioAttributes {
		public List<SentenceResults> sentenceResults { get; set; }
	}

	public class SentenceResults 
	{
		public int index { get; set; }
	}

	public class QualityModels 
	{
		/// <summary>
		/// 模型UID
		/// </summary>
		public string uid { get; set; }

		/// <summary>
		/// 模型名称
		/// </summary>
		public string name { get; set; }

		/// <summary>
		/// 命中次数
		/// </summary>
		public string hit_times { get; set; }

		/// <summary>
		/// 质检结果
		/// </summary>
		public List<SentenceResults> sentenceResults { get; set; }
	}

	public class TransData
	{
		public List<Sentence_List> sentence_list { get; set; }
	}

	public class Sentence_List 
	{

		/// <summary>
		/// 角色
		/// </summary>
		public string role { get; set; }

		/// <summary>
		/// 开始时间
		/// </summary>
		public int start { get; set; }

		/// <summary>
		/// 结束时间
		/// </summary>
		public int end { get; set; }
		
		/// <summary>
		/// index
		/// </summary>
		public int index { get; set; }

		/// <summary>
		/// 内容
		/// </summary>
		public string text { get; set; }
	}

	public class AiQualityHandler {

		/// <summary>
		/// 业务Id
		/// </summary>
		public string Id { get; set; }

		/// <summary>
		/// 文件路径
		/// </summary>
		public string AudioFile { get; set; }

		/// <summary>
		/// 来电号码
		/// </summary>
		public string FromNo { get; set; }

		/// <summary>
		/// 业务来源
		/// </summary>
		public string Source { get; set; }

		/// <summary>
		/// 来电时间
		/// </summary>
		public DateTime? CallStartTime { get; set; }

		/// <summary>
		/// 录音文件前缀地址
		/// </summary>
		public string ViteRecordPrefix { get; set; }

	}
}
