using Hotline.Share.Enums.CallCenter;
using Hotline.Share.Requests;
using System.ComponentModel.DataAnnotations;
using XF.Utility.EnumExtensions;

namespace Hotline.Share.Dtos.CallCenter;

public record BiQueryCallsDto : ReportRequiredPagedRequest
{
    /// <summary>
    /// 线路
    /// </summary>
    public string? Line { get; set; }

    /// <summary>
    /// 查询类型 1：呼入总量明细；2：接通总量明细
    /// </summary>
    public string? TypeCode { get; set; } = "1";
}

public record QueryCallListDto : PagedRequest
{
    public DateTime StartTime { get; set; }
    public DateTime EndTime { get; set; }
    public string Type { get; set; }
    public string Source { get; set; }
    public TimeSpan? StartHourTo { get; set; }
}

public class BiQueryHourCallDto : StartEndTimeDto
{

    public string Source { get; set; }
}

public class BiQueryGateWayDto : StartEndTimeDto
{
    public string Gateway { get; set; }
}

public class StartEndTimeDto
{
    [Required]
    public DateTime StartTime { get; set; }

    [Required]
    public DateTime EndTime { get; set; }
}

public record PagedStartEndTimeDto : PagedRequest 
{
    [Required]
    public DateTime StartTime { get; set; }

    [Required]
    public DateTime EndTime { get; set; }
}

public class TotalList<T>
{
    public TotalList()
    {

    }
    public TotalList(List<T> list, T total)
    {
        List = list;
        Total = total;
    }

    public T Total { get; set; }
    public List<T> List { get; set; }
}

public class TotalData<T>
{
    public TotalData()
    {

    }
    public TotalData(List<T> list, int total)
    {
        Data = list;
        Total = total;
    }

    public int Total { get; set; }
    public List<T> Data { get; set; }
}

public record QueryCallsStatisticsDetailInDto : PagedStartEndTimeDto
{
    /// <summary>
    /// 工单编号
    /// </summary>
    public string? OrderNo { get; set; }

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

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

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

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

    /// <summary>
    /// 上一个页面点击的字段名称
    /// </summary>
    public string? FieldName { get; set; }
}

public class QueryCallsStatisticsDetailOutDto
{
    public string Id { get; set; }
    public string? OrderId { get; set; }

    /// <summary>
    /// 工单号
    /// </summary>
    public string? OrderNo { get; set; }

    /// <summary>
    /// 工单标题
    /// </summary>
    public string? OrderTitle { get; set; }

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

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

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

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

    public string EndByTxt => EndBy.GetDescription();

    /// <summary>
    /// 话务员姓名
    /// </summary>
    public string UserName { get; set; }

    /// <summary>
    /// 分机组id(技能组Id)
    /// </summary>
    public string? GroupId { get; set; }

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

    /// <summary>
    /// 接听时间
    /// </summary>
    public DateTime? AnsweredTime { get; set; }

    /// <summary>
    /// 挂机时间
    /// </summary>
    public DateTime EndTime { get; set; }

    /// <summary>
    /// 通话时长(秒)
    /// </summary>
    public int Duration { get; set; }

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