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

namespace Hotline.Share.Dtos.CallCenter
{
    public record CallDto
    {
        public string Id { get; set; }
        public DateTime CreationTime { get; set; }
        public ECallDirection CallDirection { get; set; }
        public string CallDirectionText => CallDirection.GetDescription();
        public ECallStatus CallStatus { get; set; }
        public string CallStatusText => CallStatus.GetDescription();
        public ECallType CallType { get; set; }
        public string CallTypeText => CallType.GetDescription();
        public string FromNo { get; set; }
        public string ToNo { get; set; }
        public EEndBy? EndBy { get; set; }
        public string EndByText => EndBy?.GetDescription() ?? string.Empty;
        public double? Duration { get; set; }
        public string UserName { get; set; }
        public ERingOffType? RingOffType { get; set; }
        public string RingOffTypeText => RingOffType?.GetDescription() ?? string.Empty;
        public EPhoneISP? PhoneIsp { get; set; }
        public string PhoneIspText => PhoneIsp?.GetDescription() ?? string.Empty;
        public string Attribution { get; set; }
        public DateTime? InIvrTime { get; set; }
        public DateTime? InQueueTime { get; set; }
        public DateTime? RingTime{ get; set; }
        public DateTime? AnsweredTime { get; set; }
        public DateTime? ByeTime { get; set; }
        public int HoldDuration { get; set; }
    }


    public record CallWexDto
    {
        /// <summary>
        /// 主键
        /// </summary>
        public string Id { get; set; }

        /// <summary>
        /// 外部通话唯一标识
        /// </summary>
        public string CallId { get; set; }

        /// <summary>
        /// 电话方向
        /// </summary>
        public ECallDirection Direction { get; set; }

        /// <summary>
        /// 电话方向
        /// </summary>
        public string DirectionText => Direction.GetDescription();

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

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

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

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

        /// <summary>
        /// 号码归属地
        /// </summary>
        public string AreaName { get; set; }

        /// <summary>
        /// 进入IVR时间
        /// </summary>
        public DateTime? InIvrTime { get; set; }

        /// <summary>
        /// 离开IVR时间
        /// </summary>
        public DateTime? OutIvrTime { get; set; }

        /// <summary>
        /// 进入队列时间
        /// </summary>
        public DateTime? InQueueTime { get; set; }

        /// <summary>
        /// 离开队列时间
        /// </summary>
        public DateTime? OutQueueTime { get; set; }

        /// <summary>
        /// 开始时间
        /// </summary>
        public DateTime? BeginTime { get; set; }

        /// <summary>
        /// 振铃开始时间
        /// </summary>
        public DateTime? BeginRingTime { get; set; }

        /// <summary>
        /// 振铃结束时间
        /// </summary>
        public DateTime? EndRingTime { get; set; }

        /// <summary>
        /// 振铃时长
        /// </summary>
        public int RingTimes { get; set; }

        /// <summary>
        /// 应答时间
        /// </summary>
        public DateTime? AnsweredTime { get; set; }

        /// <summary>
        /// 挂断时间
        /// </summary>
        public DateTime? ByeTime { get; set; }

        /// <summary>
        /// 通话时长（秒）
        /// </summary>
        public int TalkTime { get; set; }

        /// <summary>
        /// 录音播放路径
        /// </summary>
        public string RecordUrl { get; set; }

        /// <summary>
        /// 通话结果
        /// </summary>
        public EOnState OnState { get; set; }

        /// <summary>
        /// 通话结果
        /// </summary>
        public string OnStateText => OnState.GetDescription();

        /// <summary>
        /// 挂断方
        /// </summary>
        public EEndBy EndBy { get; set; }

        /// <summary>
        /// 挂断方
        /// </summary>
        public string EndByText => EndBy.GetDescription();


        /// <summary>
        /// 中继线
        /// </summary>
        public string TrunkLine { get; set; }
    }

    public class OrderRelevanceCallIdDto
    {
        /// <summary>
        /// Id
        /// </summary>
        public string Id { get; set; }

        /// <summary>
        /// 通话Id
        /// </summary>
        public string CallId { get; set; }
    }

    public class CallRemarkDto
    {
        /// <summary>
        /// 电话号码
        /// </summary>
        public string CallNumber { get; set; }

        /// <summary>
        /// CallNo
        /// </summary>
        public string CallId { get; set; }
    }
}
