using Hotline.Share.Enums.CallCenter;
using Hotline.Share.Requests;
using Hotline.Share.Tools;
using XF.Utility.EnumExtensions;

namespace Hotline.Share.Dtos.CallCenter
{
    public class TelDto
    {
        /// <summary>
        /// 主键
        /// </summary>
        public string Id { get; set; }

        /// <summary>
        /// 分机号
        /// </summary>
        public string No { get; set; }

        public DateTime CreationTime { get; set; }

        /// <summary>
        /// 上线IP
        /// </summary>
        public string RegisterIP { get; set; }

        /// <summary>
        /// 分机线路编号
        /// </summary>
        public string LineId { get; set; }

        /// <summary>
        /// 分机状态
        /// </summary>
        public ETelStatus TelStatus { get; set; }

        /// <summary>
        /// 主叫
        /// </summary>
        public string CPN { get; set; }

        /// <summary>
        /// 被叫
        /// </summary>
        public string CDPN { get; set; }

        /// <summary>
        /// 呼叫中心通话ID
        /// </summary>
        public string? CallId { get; set; }

        /// <summary>
        /// 扩展内容（讯时设备产生的临时唯一标识：VisitorId 或 OuterId）
        /// </summary>
        public string ConversationId { get; set; }
        /// <summary>
        /// 分机详细状态
        /// </summary>
        public ETelStatusInfo TelStatusInfo { get; set; }

        public string TelStatusText => TelStatus.GetDescription();

        public string TelStatusInfoText => TelStatusInfo.GetDescription();

        public string GroupNames => string.Join(",", Groups?.Select(x => x.Name) ?? new List<string>());

        public List<TelGroupDto> Groups { get; set; }

        public string GroupsNo => Groups.NotNullOrEmpty() ? Groups.FirstOrDefault().No : "";

		#region 添润

		public string Name { get; set; }

        public string TelNo { get; set; }

        public string Description { get; set; }

        public string QueueId { get; set; }

        /// <summary>
        /// 外呼分机组（由内部系统提供）
        /// </summary>
        public string? CallOutQueue { get; set; }

        #endregion
    }


    /// <summary>
    /// 分机查询入参
    /// </summary>
    /// <param name="No">分机号</param>
    public record QueryTelsInDto(string? No) : PagedRequest
    {
    }

    public class EndActionInDto
    {
        public string StaffNo { get; set; }
        public string TelNo { get; set; }
        public int Status { get; set; }
    }

    public class NotifyStatusInDto
    {
        /// <summary>
        /// 应用Id
        /// </summary>
        public string AppId { get; set; }

        /// <summary>
        /// 应用秘钥
        /// </summary>
        public string AppSecret { get; set; }

        /// <summary>
        /// 分机号
        /// </summary>
        public string TelNo { get; set; }

        /// <summary>
        /// 员工号
        /// </summary>
        public string StaffNo { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public int Status { get; set; }
    }
}
