using Hotline.Share.Dtos;
using Hotline.Share.Dtos.Order;
using Hotline.Share.Enums.Order;
using System.ComponentModel.DataAnnotations;
using XF.Utility.EnumExtensions;

namespace Hotline.Share.Requests;

public record PagedKeywordRequest : PagedRequest
{
    /// <summary>
    /// 开始时间
    /// </summary>
    public DateTime? StartTime { get; set; }

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

    public string? Keyword { get; set; }

    /// <summary>
    /// 排序字段 
    /// </summary>
    public string? SortField { get; set; }

    /// <summary>
    /// 排序规则  0 升序  1 降序
    /// </summary>
    public int? SortRule { get; set; }
}
public record PagedKeywordSonRequest : PagedRequest
{
    /// <summary>
    /// 开始时间
    /// </summary>
    public DateTime? StartTime { get; set; }

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

    public string? OrgName { get; set; }
    public string? OrgCode { get; set; }
    /// <summary>
    /// 1:办件结果 2:办件态度
    /// </summary>
    public int? TypeId { get; set; }

    public string? LineNum { get; set; }

    /// <summary>
    /// 来电/信人身份0：全部 ，1：市民，2：企业
    /// </summary>
    public int? TypeCode { get; set; }

    /// <summary>
    /// 回访方式
    /// </summary>
    public EVisitType? VisitType { get; set; }

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

    /// <summary>
    /// 工单编码
    /// </summary>
    public string? No { get; set; }

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

    /// <summary>
    /// 受理结束时间
    /// </summary>
    public DateTime? CreationTimeEnd { get; set; }

    /// <summary>
    /// 部门分类
    /// </summary>
    public EOrgVisitStatisticsType? OrgVisitStatisticsType { get; set; }

    /// <summary>
    /// 来源渠道
    /// </summary>
    public string Channel { get; set; }

    /// <summary>
    /// 回访人
    /// </summary>
    public string? VisitUser { get; set; }

    /// <summary>
    /// 办件态度类型(1:办件结果; 2:办事态度)
    /// 默认 办件结果;
    /// </summary>
    public EAttitudeType AttitudeType { get; set; } = EAttitudeType.ProcessingResult;

    /// <summary>
    /// 办件结果
    /// </summary>
    public string? OrgProcessingResults { get; set; }

    /// <summary>
    /// 热点分类
    /// </summary>
    public string Hotspot { get; set; }

    /// <summary>
    /// 回访部门
    /// </summary>
    public string OrgId { get; set; }

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

    /// <summary>
    /// 办结结束时间
    /// </summary>
    public DateTime? ActualHandleTimeEnd { get; set; }

    /// <summary>
    /// 是否省工单（空为全部  true为省工单 false为市工单）
    /// </summary>
    public bool? IsProvinceOrder { get; set; }

    /// <summary>
    /// 内容检索（回访内容）
    /// </summary>
    public string? ContentRetrieval { get; set; }
}
public record VisitAndHotspotPagedKeywordRequest : PagedKeywordRequest
{
    /// <summary>
    /// 热点名称
    /// </summary>
    public string? HotspotName { get; set; }

    /// <summary>
    /// 热点id
    /// </summary>
    public string? HotspotId { get; set; }

    /// <summary>
    /// 1:办件结果 2:办件态度
    /// </summary>
    public int TypeId { get; set; }

    /// <summary>
    /// 标题名称
    /// </summary>

    public string? TitleCode { get; set; }
}
public record ReportPagedRequest : PagedKeywordRequest
{
    /// <summary>
    /// 来电/信人身份0：全部 ，1：市民，2：企业
    /// </summary>
    public int? TypeId { get; set; }
}

/// <summary>
/// 验证了 startTime 和 endTime 不能为空;
/// <inheritdoc cref="ReportRequiredPagedRequestValidator"/>
/// </summary>
public record ReportRequiredPagedRequest : PagedKeywordRequest
{
    /// <summary>
    /// 来电/信人身份0：全部 ，1：市民，2：企业
    /// </summary>
    public int? TypeId { get; set; }
}

public record OrgDataListDetailRequest : PagedRequest
{
    /// <summary>
    /// 开始时间
    /// </summary>
    public DateTime StartTime { get; set; }
    /// <summary>
    /// 结束时间
    /// </summary>
    public DateTime EndTime { get; set; }
    /// <summary>
    /// 部门Code
    /// </summary>
    public string OrgCode { get; set; }

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

    /// <summary>
    /// 查询状态 1：业务已办超期  2：会签已办超期  3：业务待办超期  4：会签待办超期  5：小计
    /// </summary>
    public int QueryType { get; set; }

    /// <summary>
    /// 超期类型 1：系统中超期  2：申请延期超期
    /// </summary>
    public int ExpiredType { get; set; }

    /// <summary>
    /// 来电/信人身份0：全部 ，1：市民，2：企业
    /// </summary>
    public int? TypeId { get; set; }
}
/// <summary>
/// 部门超期全部数据
/// </summary>
public record OrgDataListAllDetailRequest : PagedKeywordRequest
{
    /// <summary>
    /// 部门Code
    /// </summary>
    public string OrgName { get; set; }

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

    /// <summary>
    /// 超期类型 1：系统中超期  2：申请延期超期
    /// </summary>
    public int ExpiredType { get; set; }

    /// <summary>
    /// 工单状态（√）
    /// </summary>
    public List<EOrderStatus> Statuses { get; set; } = new();
}

public record PublishedPagedRequest : PagedKeywordRequest
{
    /// <summary>
    /// 是否解决
    /// </summary>
    public bool? Resolve { get; set; }

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

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

    /// <summary>
    /// 受理时间(工单创建时间)
    /// </summary>
    public DateTime? CreationTimeStart { get; set; }
    public DateTime? CreationTimeEnd { get; set; }

    /// <summary>
    /// 来电号码（×）
    /// </summary>
    public string? FromPhone { get; set; }

    /// <summary>
    /// 接办名称（综合查询使用）
    /// </summary>
    public string? ActualHandleOrgName { get; set; }

    /// <summary>
    /// 受理类型（√）
    /// </summary>
    public string? AcceptType { get; set; }

    /// <summary>
    /// 热点分类关键词
    /// </summary>
    public string? Hotspot { get; set; }

    /// <summary>
    /// 受理坐席名字或工号（×）
    /// </summary>
    public string? NameOrNo { get; set; }

    /// <summary>
    /// 发布人名称
    /// </summary>
    public string? PublishName { get; set; }

    /// <summary>
    /// 是否超期
    /// </summary>
    public bool? IsOverTime { get; set; }

    /// <summary>
    /// 查询批次
    /// </summary>
    public int QueryIndex { get; set; }

    /// <summary>
    /// 一级部门
    /// </summary>
    public string? OrgLevelOneName { get; set; }

    /// <summary>
    /// 来电主体
    /// </summary>
    public EIdentityType? IdentityType { get; set; }

    /// <summary>
    /// 省来源分类 1：政民互动直派 2：政民互动  3：省12345
    /// </summary>
    public string? ProvinceChannel { get; set; }

	/// <summary>
	/// 发布范围 是否公开
	/// </summary>
	public bool? PublishState { get; set; }
}

public record HotspotSubtotalReportPagedRequest : ReportPagedRequest
{

    public string Id { get; set; }
}

public record HotPortJoinOrgStatisticsRequest
{
    public DateTime StartTime { get; set; }

    public DateTime EndTime { get; set; }
}

public record ExportHotPortJoinOrgStatisticsRequest
{
	public DateTime? StartTime { get; set; }

	public DateTime? EndTime { get; set; }

	/// <summary>
	/// 导出列名
	/// </summary>
	public List<string> AddColumnName { get; set; } = new();
}

public record  HotPortJoinOrgStatisticsRequestDetail: PagedRequest
{
	public DateTime StartTime { get; set; }

	public DateTime EndTime { get; set; }

	public string? OrgCode { get; set; }

    public string? HotspotCode { get; set; }
}

public record VisitMeasureStatisticsRequest
{
    public DateTime StartTime { get; set; }
    public DateTime EndTime { get; set; }

    public string? VisitName { get; set; }
}


public record AiVisitNoSatisfiedPageListRequest:PagedRequest
{
    public DateTime StartTime { get; set; }
    public DateTime EndTime { get; set; }

    public string? VisitName { get; set; }
}

public class AiVisitNoSatisfiedPageListRep
{
    public OrderVisitDto OrderVisit { get; set; }
}

public record HotspotReportPagedRequest : ReportPagedRequest
{

    public string Id { get; set; }

    /// <summary>
    /// 查询类型  年 3 月 2 日 1 自定义 0
    /// </summary>
    public int Type { get; set; }

    public DateTime? ChainStartTime { get; set; }

    public DateTime? ChainEndTime { get; set; }
}


public record QuerySeatRestRequest : ReportRequiredPagedRequest
{
    public string? UserName { get; set; }

    public string? StaffNo { get; set; }

}

public record QuerySeatSwitchRequest : ReportRequiredPagedRequest
{
    public string? UserName { get; set; }

    public string? CDPN { get; set; }

}

public record QueryVisitNoSatiisfiedRequest : ReportPagedRequest
{
    /// <summary>
    /// 回访结果 空查询全部，-1：视为满意；2：不满意
    /// </summary>
    public string? OrgProcessingResults { get; set; }

    public string? OrgName { get; set; }

}

public record BiQueryVisitNoSatisfiedDetailDto : ReportPagedRequest
{
    /// <summary>
    /// 回访结果 空查询全部，-1：视为满意；2：不满意
    /// </summary>
    public string? OrgProcessingResults { get; set; }

    /// <summary>
    /// 部门Code
    /// </summary>
    public string OrgCode { get; set; }

    /// <summary>
    /// 部门名称
    /// </summary>
    public string? VisitOrgName { get; set; }

    /// <summary>
    /// 不满意原因Key
    /// </summary>
    public string DissatisfiedKey { get; set; }
}

public record QueryOrderDelayDataListRequest : ReportPagedRequest
{
    public string? OrgName { get; set; }
}


public record QueryOrderDelayDataDetailRequest : ReportRequiredPagedRequest
{
    public string? OrgCode { get; set; }

    /// <summary>
    /// 查询类型  1已同意次数 2 未同意次数 3  审批中次数 4 小计 5:撤销
    /// </summary>
    public int? Type { get; set; }

}

public record QueryOrderReTransactRequest : ReportPagedRequest
{
    public string? OrgName { get; set; }

}

public record QuerySecondaryHandlingRequest : ReportPagedRequest
{
    public string? OrgName { get; set; }

    public string? OrgId { get; set; }

    /// <summary>
    ///  1  办件结果
    /// </summary>
    public int VisitTypeId { get; set; }

    public string? CDPN { get; set; }

    public string Header { get; set; }

}

public record QueryOrderReTransactDetailRequest : ReportPagedRequest
{
    public string? OrgName { get; set; }

    public string? ErrorName { get; set; }

    public string? No { get; set; }

}

public record QuerySendOrderRequest
{
    public string? UserName { get; set; }


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

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

}

public record QuerySendOrderDetailRequest : ReportPagedRequest
{
    public string UserId { get; set; }

    public string TitleCode { get; set; }

    public string RoleName { get; set; }
}

public record QueryUnsignedOrdersRequest : ReportPagedRequest
{
    /// <summary>
    ///  0 全部  1 本级  2 下级
    /// </summary>
    public int Level { get; set; }

    /// <summary>
    ///  0 未签收  1 签收
    /// </summary>
    public int Signed { get; set; }
}

public record QueryOrderSourceRequest : ReportPagedRequest
{
    /// <summary>
    /// 来电/信人身份0：全部 ，1：市民，2：企业
    /// </summary>
    public int? TypeId { get; set; }

    /// <summary>
    /// 导出列名
    /// </summary>
    public List<string> AddColumnName { get; set; }
}

public record QueryOrderSourceDetailRequest : QueryOrderSourceRequest
{
    /// <summary>
    /// 来电/信人身份0：全部 ，1：市民，2：企业
    /// </summary>
    public int? TypeId { get; set; }

    /// <summary>
    /// 点击时间
    /// </summary>
    public DateTime? Time { get; set; }

    /// <summary>
    /// 来源渠道（电话、网站、APP等）
    /// </summary>
    public string? SourceChannel { get; set; }
}

/// <summary>
/// 分时统计
/// </summary>
public record TimeSharingPagedKeywordRequest : PagedKeywordRequest
{
    /// <summary>
    /// 来电/信人身份0：全部 ，1：市民，2：企业
    /// </summary>
    public int? TypeId { get; set; }

    /// <summary>
    /// 导出列名
    /// </summary>
    public List<string> AddColumnName { get; set; }
}


public record OrgVisitDetailListReq : PagedKeywordRequest
{
    /// <summary>
    /// 一级部门（id或名称）
    /// </summary>
    public string? LevelOneOrg { get; set; }

    /// <summary>
    /// 接办部门
    /// </summary>
    public string? ActualHandleOrgName { get; set; }

    /// <summary>
    /// 部门分类
    /// </summary>
    public EOrgVisitStatisticsType? OrgVisitStatisticsType { get; set; }

    /// <summary>
    /// 部门办件结果
    /// </summary>
    public string? OrgProcessingResults { get; set; }

    /// <summary>
    /// 回访人
    /// </summary>
    public string? VisitUser { get; set; }

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

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

    /// <summary>
    /// 回访部门
    /// </summary>
    public string OrgId { get; set; }

    /// <summary>
    /// 热点分类
    /// </summary>
    public string Hotspot { get; set; }

    /// <summary>
    /// 来源渠道（√）
    /// </summary>
    public string Channel { get; set; }

    /// <summary>
    /// 受理时间(工单创建时间)（√）
    /// </summary>
    public DateTime? CreationTimeStart { get; set; }
    public DateTime? CreationTimeEnd { get; set; }

    /// <summary>
    /// 办结时间（√）
    /// </summary>
    public DateTime? ActualHandleTimeStart { get; set; }
    public DateTime? ActualHandleTimeEnd { get; set; }

    /// <summary>
    /// 回访时间
    /// </summary>
    public DateTime? VisitTimeStart { get; set; }

    public DateTime? VisitTimeEnd { get; set; }

    /// <summary>
    /// 办件态度类型(1:办件结果; 2:办事态度)
    /// 默认 办件结果;
    /// </summary>
    public EAttitudeType AttitudeType { get; set; } = EAttitudeType.ProcessingResult;

    /// <summary>
    /// 来电主体
    /// </summary>
    public int TypeCode { get; set; }

    /// <summary>
    /// 排序字段
    /// </summary>
    public string? SortField { get; set; }

    /// <summary>
    /// 排序方式 // 0 升序 1 降序
    /// </summary>
    public int? SortRule { get; set; }

    /// <summary>
    /// 回访方式
    /// </summary>
    public EVisitType? VisitType { get; set; }

    /// <summary>
    /// 是否省工单（空为全部  true为省工单 false为市工单）
    /// </summary>
    public bool? IsProvinceOrder { get; set; }

    /// <summary>
    /// 内容检索（回访内容）
    /// </summary>
    public string? ContentRetrieval { get; set; }

    /// <summary>
    /// 是否甄别
    /// </summary>
    public bool? IsScreen { get; set; }

    /// <summary>
    /// 工单标签Code
    /// </summary>
    public string? OrderTagCode { get; set; }

    /// <summary>
    /// 来源渠道
    /// </summary>
    public string? SourceChannelCode { get; set; }

    /// <summary>
    /// 受理类型
    /// </summary>
    public string? AcceptTypeCode { get; set; }

    /// <summary>
    /// 不满意原因
    /// </summary>
    public string? OrgNoSatisfiedReason { get; set; }

    /// <summary>
    /// 区域
    /// </summary>
    public string? AreaCode {  get; set; }
}


public record HotspotAndAreaStatisticsReq
{
    public int HotspotLevel { get; set; }

    public DateTime StartTime { get; set; }

    public DateTime EndTime { get; set; }

    /// <summary>
    /// 导出列名
    /// </summary>
    public List<string> AddColumnName { get; set; } = new();

}

public record AcceptTypeStatisticsByDateDetailReq : PagedRequest
{
    /// <summary>
    /// 日期
    /// </summary>
    public DateTime Date { get; set; }
    /// <summary>
    /// 工单编号
    /// </summary>
    public string No { get; set; }
    /// <summary>
    /// 工单标题
    /// </summary>
    public string Title { get; set; }
    /// <summary>
    /// 接办部门名称
    /// </summary>
    public string? ActualHandleOrgName { get; set; }

    /// <summary>
    /// 受理类型Code
    /// </summary>
    public string AcceptTypeCode { get; set; }
}

public class AcceptTypeStatisticsByDateReq
{
    public DateTime StartTime { get; set; }

    public DateTime EndTime { get; set; }

    /// <summary>
    /// 0：全部 ，1：市民，2：企业
    /// </summary>
    public int? TypeId { get; set; }

    public string Gateway { get; set; }

    /// <summary>
    /// 导出列名
    /// </summary>
    public List<string> AddColumnName { get; set; } = new();
}

public class AcceptTypeStatisticsReq
{
    public DateTime StartTime { get; set; }

    public DateTime EndTime { get; set; }

    /// <summary>
    /// 0：全部 ，1：市民，2：企业
    /// </summary>
    public int? TypeId { get; set; }

    public string Gateway { get; set; }



}

public record HotspotAndAreaStatisticsDetailReq : PagedRequest
{
    public string? AreaCode { get; set; }

    public string HotspotId { get; set; }

    public DateTime StartTime { get; set; }

    public DateTime EndTime { get; set; }
}



public class HotspotAndAreaStatisticsDetailDto
{
    public EExpiredStatus? CalculateExpiredState()
    {
        DateTime? dateTime = DateTime.Now;
        if (Status >= EOrderStatus.Filed)
        {
            dateTime = ActualHandleTime;
        }
        if (ExpiredTime.HasValue)
        {
            if (NearlyExpiredTimeOne.HasValue && dateTime < NearlyExpiredTimeOne)
            {
                return EExpiredStatus.Normal;
            }
            else if (!NearlyExpiredTimeOne.HasValue && dateTime < NearlyExpiredTime)
            {
                return EExpiredStatus.Normal;
            }
            else if (NearlyExpiredTimeOne.HasValue && dateTime > NearlyExpiredTimeOne && dateTime < NearlyExpiredTime)
            {
                return EExpiredStatus.GoingToExpiredOne;
            }
            else if (dateTime > NearlyExpiredTime && dateTime < ExpiredTime)
            {
                return EExpiredStatus.GoingToExpired;
            }
            else
            {
                return EExpiredStatus.Expired;
            }
        }
        return null;
    }

    public string Id { get; set; }
    /// <summary>
    /// 工单状态
    /// </summary>
    public EOrderStatus Status { get; set; }

    public string StatusText => Status.GetDescription();

    /// <summary>
    /// 来源渠道（电话、网站、APP等）
    /// </summary>
    public string? SourceChannel { get; set; }

    /// <summary>
    /// 过期状态
    /// </summary>
    public EExpiredStatus? ExpiredStatus => CalculateExpiredState();

    /// <summary>
    /// 过期状态
    /// </summary>
    public string ExpiredStatusText => ExpiredStatus?.GetDescription() ?? string.Empty;

    /// <summary>
    /// 当前节点
    /// </summary>
    public string? ActualHandleStepName { get; set; }

    /// <summary>
    /// 重办次数
    /// </summary>
    public int? ReTransactNum { get; set; }

    /// <summary>
    /// 紧急程度
    /// </summary>
    public bool IsUrgent { get; set; }

    public string IsUrgentText => IsUrgent ? "紧急" : "";

    /// <summary>
    /// 甄别状态
    /// </summary>
    public EScreenStatus? OrderScreenStatus { get; set; }

    public string OrderScreenStatusText => OrderScreenStatus?.GetDescription();

    /// <summary>
    /// 工单编号
    /// </summary>
    public string No { get; set; }

    /// <summary>
    /// 受理时间
    /// </summary>
    public DateTime CreationTime { get; set; }

    /// <summary>
    /// 标题
    /// </summary>
    public string Title { get; set; }

    /// <summary>
    /// 超期时间
    /// </summary>
    public DateTime? ExpiredTime { get; set; }

    /// <summary>
    /// 即将超期时间
    /// </summary>
    public DateTime? NearlyExpiredTime { get; set; }

    /// <summary>
    /// 即将超期时间第一级
    /// </summary>
    public DateTime? NearlyExpiredTimeOne { get; set; }

    /// <summary>
    /// 接办部门名称
    /// </summary>
    public string? ActualHandleOrgName { get; set; }

    /// <summary>
    /// 接办时间
    /// </summary>
    public DateTime? ActualHandleTime { get; set; }

    /// <summary>
    /// 办结时间
    /// </summary>
    public DateTime? FiledTime { get; set; }

    /// <summary>
    /// 受理类型
    /// </summary>
    public string? AcceptType { get; set; }

    /// <summary>
    /// 热点类型
    /// </summary>
    public string? HotspotName { get; set; }

    /// <summary>
    /// 受理人名称
    /// </summary>
    public string? AcceptorName { get; set; }
}


public class AcceptTypeStatisticsDto
{
    /// <summary>
    /// 受理类型
    /// </summary>
    public string AcceptType { get; set; }
    /// <summary>
    /// 分类量
    /// </summary>
    public int SumCount { get; set; }

    /// <summary>
    /// 办结量
    /// </summary>
    public int CompletionCount { get; set; }

    /// <summary>
    /// 办结率
    /// </summary>
    public string CompletionRate => SumCount > 0 ? Math.Round((double)CompletionCount / (double)SumCount * 100, digits: 3) + "%" : 0.000 + "%";

    /// <summary>
    /// 回访量
    /// </summary>
    public int VisitCount { get; set; }

    /// <summary>
    /// 回访率
    /// </summary>
    public string VisitRate => SumCount > 0 ? Math.Round((double)VisitCount / (double)SumCount * 100, digits: 3) + "%" : 0.000 + "%";

    /// <summary>
    /// 占比
    /// </summary>
    public string SumCountRate { get; set; }
}

public record HotspotAndAcceptTypeStatisticsReq
{
    public int HotspotLevel { get; set; }

    public DateTime StartTime { get; set; }

    public DateTime EndTime { get; set; }

    /// <summary>
    /// 导出列名
    /// </summary>
    public List<string> AddColumnName { get; set; } = new();

}

public record HotspotAndAcceptTypeStatisticsDetailReq : PagedRequest
{
    public string? AcceptTypeCode { get; set; }

    public string HotspotId { get; set; }

    public DateTime StartTime { get; set; }

    public DateTime EndTime { get; set; }
}

public record OrderScreenApplyPagedRequest : PagedKeywordRequest
{
    /// <summary>
    /// 提起人
    /// </summary>
    public string ApplyUserName { get; set; }

    /// <summary>
    /// 部门名称
    /// </summary>
    public string ApplyOrgName { get; set; }
}

public record OrderScreenAuditPagedRequest : PagedKeywordRequest
{
    /// <summary>
    /// 审批人
    /// </summary>
    public string AuditUserName { get; set; }

    /// <summary>
    ///  1 中心班长   2 中心领导 3中心初审
    /// </summary>
    public int? AuditType { get; set; }

    /// <summary>
    /// 节点名称
    /// </summary>
    public string? StepName { get; set; }

}

public record OrderCenterAcceptPagedRequest : PagedKeywordRequest
{
    /// <summary>
    /// 来电/信人身份0：全部 ，1：市民，2：企业
    /// </summary>
    public int? TypeCode { get; set; }

}

public record OrderDataInventoryReq : PagedRequest
{
    /// <summary>
    /// 受理时间开始
    /// </summary>
    public DateTime StartTime { get; set; }
    /// <summary>
    /// 受理时间结束
    /// </summary>
    public DateTime EndTime { get; set; }

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

    /// <summary>
    /// 标题
    /// </summary>
    public string? Title { get; set; }

    /// <summary>
    /// 工单状态
    /// </summary>
    public EOrderStatus? OrderStatus { get; set; }

    /// <summary>
    /// 来源渠道
    /// </summary>
    public string? Channel { get; set; }

    /// <summary>
    /// 转接来源
    /// </summary>
    public string? TransferPhone { get; set; }

    /// <summary>
    /// 当前节点
    /// </summary>
    public string? CurrentStepCode { get; set; }

    /// <summary>
    /// 甄别状态
    /// </summary>
    public EScreenStatus? ScreenStatus { get; set; }

    /// <summary>
    /// 超期状态
    /// </summary>
    public EExpiredStatusEx? ExpiredStatus { get; set; }

    /// <summary>
    /// 省编号
    /// </summary>
    public string? ProvinceNo { get; set; }

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

    /// <summary>
    /// 期满时间结束
    /// </summary>
    public DateTime? ExpiredTimeEnd { get; set; }

    /// <summary>
    /// 一级部门
    /// </summary>
    public string? OrgLevelOneName { get; set; }

    /// <summary>
    /// 二级部门
    /// </summary>
    public string? OrgLevelTwoName { get; set; }

    /// <summary>
    /// 接办部门
    /// </summary>
    public string? CurrentHandleOrgId { get; set; }

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

    /// <summary>
    /// 办结时间结束
    /// </summary>
    public DateTime? FiledTimeEnd { get; set; }

    /// <summary>
    /// 受理类型
    /// </summary>
    public string? AcceptType { get; set; }

    /// <summary>
    /// 热点分类
    /// </summary>
    public string? Hotspot { get; set; }

    /// <summary>
    /// 区域
    /// </summary>
    public string? AreaCode { get; set; }

    /// <summary>
    /// 受理人或工号
    /// </summary>
    public string? NameOrNo { get; set; }

    /// <summary>
    /// 来电人姓名
    /// </summary>
    public string? FromName { get; set; }

    /// <summary>
    /// 来电人姓名
    /// </summary>
    public string? FromPhone { get; set; }

    /// <summary>
    /// 联系电话
    /// </summary>
    public string? PhoneNo { get; set; }

    /// <summary>
    /// 来电主体
    /// </summary>
    public EIdentityType? IdentityType { get; set; }

    /// <summary>
    /// 来电/信人性别
    /// </summary>
    public EGender? FromGender { get; set; }

    /// <summary>
    /// 推送分类
    /// </summary>
    public string? PushTypeCode { get; set; }

}
public class OrderDataInventoryRep
{
    /// <summary>
    /// 工单ID
    /// </summary>
    public string Id { get; set; }
    /// <summary>
    /// 工单状态
    /// </summary>
    public EOrderStatus? OrderStatus { get; set; }

    /// <summary>
    /// 工单状态
    /// </summary>
    public string OrderStatusText => OrderStatus.GetDescription();

    /// <summary>
    /// 过期状态
    /// </summary>
    public EExpiredStatusEx? ExpiredStatus => CalculateExpiredState();

    /// <summary>
    /// 过期状态
    /// </summary>
    public string ExpiredStatusText => ExpiredStatus?.GetDescription() ?? string.Empty;

    public DateTime? ActualHandleTime { get; set; }

    public DateTime? NearlyExpiredTime { get; set; }

    public EExpiredStatusEx? CalculateExpiredState()
    {
        DateTime? dateTime = DateTime.Now;
        if (OrderStatus >= EOrderStatus.Filed)
        {
            dateTime = FiledTime;
        }
        //ExpiredStatus
        if (ExpiredTime.HasValue)
        {

            if (dateTime < NearlyExpiredTime)
            {
                return EExpiredStatusEx.Normal;
            }
            else if (dateTime > NearlyExpiredTime && dateTime < ExpiredTime)
            {
                return EExpiredStatusEx.GoingToExpired;
            }
            else
            {
                return EExpiredStatusEx.Expired;
            }
        }
        return null;
    }

    /// <summary>
    /// 来源
    /// </summary>
    public string SourceChannel { get; set; }

    /// <summary>
    /// 转接号码
    /// </summary>
    public string TransferPhone { get; set; }

    /// <summary>
    /// 当前节点
    /// </summary>
    public string CurrentStepName { get; set; }

    /// <summary>
    /// 重办次数
    /// </summary>
    public int? ReTransactNum { get; set; }

    //甄别状态
    public EScreenStatus? OrderScreenStatus { get; set; }

    public string? OrderScreenStatusText => OrderScreenStatus?.GetDescription();


    /// <summary>
    /// 工单编号
    /// </summary>
    public string No { get; set; }

    /// <summary>
    /// 省编号
    /// </summary>
    public string ProvinceNo { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>

    public DateTime CreationTime { get; set; }

    /// <summary>
    /// 标题
    /// </summary>
    public string Title { get; set; }

    /// <summary>
    /// 期满时间
    /// </summary>
    public DateTime? ExpiredTime { get; set; }

    /// <summary>
    /// 一级部门
    /// </summary>
    public string? OrgLevelOneName { get; set; }

    /// <summary>
    /// 二级部门
    /// </summary>
    public string? OrgLevelTwoName { get; set; }

    /// <summary>
    /// 接办部门
    /// </summary>
    public string? CurrentHandleOrgName { get; set; }


    /// <summary>
    /// 办结时间
    /// </summary>
    public DateTime? FiledTime { get; set; }

    /// <summary>
    /// 受理类型
    /// </summary>
    public string AcceptType { get; set; }

    /// <summary>
    /// 热点类型
    /// </summary>
    public string HotspotName { get; set; }

    /// <summary>
    /// 热点全名
    /// </summary>
    public string HotspotSpliceName { get; set; }

    /// <summary>
    /// 区域名称
    /// </summary>
    public string AreaName { get; set; }

    /// <summary>
    /// 区域全名
    /// </summary>
    public string FullAreaName { get; set; }

    /// <summary>
    /// 受理人
    /// </summary>
    public string AcceptorName { get; set; }

    /// <summary>
    /// 来电人名称
    /// </summary>
    public string FromName { get; set; }

    /// <summary>
    /// 联系电话
    /// </summary>
    public string Contact { get; set; }

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

    /// <summary>
    /// 地址
    /// </summary>
    public string? Address { get; set; }

    /// <summary>
    /// 来电/信人身份
    /// </summary>
    public EIdentityType? IdentityType { get; set; }

    public string? IdentityTypeText => IdentityType?.GetDescription();

    /// <summary>
    /// 来电/信人性别
    /// </summary>
    public EGender FromGender { get; set; }

    public string? FromGenderText => FromGender.GetDescription();

    //坐席评价
    public ESeatEvaluate? SeatEvaluate { get; set; }

    public string? SeatEvaluateText => SeatEvaluate?.GetDescription();

    //办理结果
    public string? OrgProcessingResults { get; set; }

    public string? PushType { get; set; }

    /// <summary>
    /// 受理内容
    /// </summary>
    public string? Content { get; set; }

    /// <summary>
    /// 承办意见
    /// </summary>
    public string? ActualOpinion { get; set; }

    /// <summary>
    /// 归档意见
    /// </summary>
    public string? FileOpinion { get; set; }
}

public class OrderVisitJudeStatisticsReq
{
    /// <summary>
    /// 开始时间
    /// </summary>
    public DateTime? StartTime { get; set; }
    /// <summary>
    /// 结束时间
    /// </summary>
    public DateTime? EndTime { get; set; }


}

public class OrderVisitJudeStatisticsRep
{
    /// <summary>
    /// 回访员
    /// </summary>
    public string EmpName { get; set; }

    public string EmpId { get; set; }

    /// <summary>
    /// 部门扭转总件
    /// </summary>
    public int OrgJudeCount { get; set; }

    /// <summary>
    /// 部门扭转待审批件
    /// </summary>
    public int OrgJudeApprovalingCount { get; set; }

    /// <summary>
    /// 部门扭转审批成功件
    /// </summary>
    public int OrgJudeSuccessCount { get; set; }

    /// <summary>
    /// 部门扭转审批失败件
    /// </summary>
    public int OrgJudeFailCount { get; set; }

    /// <summary>
    /// 坐席扭转总件
    /// </summary>
    public int SeatJudeCount { get; set; }

    /// <summary>
    /// 坐席扭转待审批件
    /// </summary>
    public int SeatJudeApprovalingCount { get; set; }

    /// <summary>
    /// 坐席扭转审批成功件
    /// </summary>
    public int SeatJudeSuccessCount { get; set; }

    /// <summary>
    /// 坐席扭转审批失败件
    /// </summary>
    public int SeatJudeFailCount { get; set; }

}


public record OrderVisitJudeDetailReq : PagedRequest
{

}


public class OrderVisitJudeDetailRep
{

}

public record HotspotStatisticsRep : PagedKeywordRequest
{
    ///// <summary>
    ///// 开始时间
    ///// </summary>
    //public DateTime? StartTime { get; set; }

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

    public int TypeId { get; set; }
    public string? HotspotCode { get; set; }
}

public record SysLogPagedKeywordRequest : PagedKeywordRequest
{
    /// <summary>
    /// 操作动作
    /// </summary>
	public string? Name { get; set; }

    /// <summary>
    /// 操作人
    /// </summary>
    public string? CreatorName { get; set; }

    /// <summary>
    /// 操作地址
    /// </summary>
    public string? ExecuteUrl { get; set; }

    /// <summary>
    /// 请求参数
    /// </summary>
    public string? ExecuteParam { get; set; }

    /// <summary>
    /// 是否查询全部
    /// </summary>
    public bool? IsAll { get; set; }
}

public record SeatSatisfactionOrderVisitRequest : PagedKeywordRequest
{
    public ESeatEvaluate? SeatEvaluate { get; set; }

    public string? UserId { get; set; }

    public string? UserName { get; set; }

    public string? Title { get; set; }

    public string? No { get; set; }
}

public record QualityWorkAnalysisRequest : PagedKeywordRequest
{

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

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

    /// <summary>
    /// 受理人
    /// </summary>
    public string? AcceptorId { get; set; }

}

public record ExtendedSendBackRequest : PagedKeywordRequest 
{
    public string? No { get; set; }

    public string? Title { get; set; }

    public string? OrgId { get; set; }

    /// <summary>
    /// 统计表列类型值  退回总量 1  退回审批通过量 2  退回审批不通过量 3  退回审批中 4
    /// </summary>
    public ExtendedSendBackType? Type { get; set; }

	/// <summary>
	/// 来源渠道（√）
	/// </summary>
	public string? Channel { get; set; }

	/// <summary>
	/// 受理类型（√）
	/// </summary>
	public string? AcceptType { get; set; }

	/// <summary>
	/// 热点分类
	/// </summary>
	public string? Hotspot { get; set; }


	/// <summary>
	/// 受理时间(工单创建时间)（√）
	/// </summary>
	public DateTime? CreationTimeStart { get; set; }
	public DateTime? CreationTimeEnd { get; set; }

    /// <summary>
    /// 申请部门
    /// </summary>
    public string? ApplyOrgName { get; set; }

    /// <summary>
    /// 申请人
    /// </summary>
	public string? ApplyUserName { get; set; }

	/// <summary>
	/// 退回审批状态
	/// </summary>
	public ESendBackAuditState? State { get; set; }

    /// <summary>
    /// 审批人
    /// </summary>
	public string? AuditUser { get; set; }

	/// <summary>
	/// 审批时间
	/// </summary>
	public DateTime? AuditTimeStart { get; set; }

	public DateTime? AuditTimeEnd { get; set; }

	/// <summary>
	/// 审批意见
	/// </summary>
	public string? AuditContent { get; set; }

}

public enum ExtendedSendBackType {
	TotalNum = 1,
	PassNum =2,
	NoPassNum =3,
	AuditNum =4
}

#region 智能回访

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

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

public class QueryAiVisitStatisticsResp
{
    /// <summary>
    /// 智能回访总量(去重)
    /// </summary>
    public int AiVisitCount { get; set; }

    /// <summary>
    /// 智能回访有效量(去重)
    /// </summary>
    public int AiVisitSuccessCount { get; set; }

    /// <summary>
    /// 人工待复核量
    /// </summary>
    public int AiVisitArtificialReviewCount { get; set; }

    /// <summary>
    /// 人工电话复核回访量
    /// </summary>
    public int AiVisitCallReviewCount { get; set; }

    /// <summary>
    /// 人工手动复核填写量
    /// </summary>
    public int AiVisitHandReviewCount { get; set; }
}


public class QueryAiVisitEffectiveAnalysisResp
{
    /// <summary>
    /// 智能回访总量(不去重)
    /// </summary>
    public int AiVisitCount { get; set; }

    /// <summary>
    /// 智能回访有效量(不去重)
    /// </summary>
    public int AiVisitSuccessCount { get; set; }

    /// <summary>
    /// 拨打两次失败量
    /// </summary>
    public int AiVisitCallTwoFailCount { get; set; }

    /// <summary>
    /// 有一个答案的数量
    /// </summary>
    public int AiVisitHaveOneAnswerCount { get; set; }

    /// <summary>
    /// 有两个答案的数量
    /// </summary>
    public int AiVisitHaveTwoAnswerCount { get; set; }

    /// <summary>
    /// 有三个答案的数量
    /// </summary>
    public int AiVisitHaveThreeAnswerCount { get; set; }
}
#endregion

public class OnlineMassLineReportRequest
{
    public DateTime StartTime { get; set; }

    public DateTime EndTime { get; set; }

    public DateTime ChainStartTime { get; set; }

    public DateTime ChainEndTime { get; set; }
}

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

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

    /// <summary>
    /// 0：全部 ，1：市民，2：企业
    /// </summary>
    public int? TypeId { get; set; }

    /// <summary>
    /// 上级区域Id
    /// </summary>
    public string? AreaCode { get; set; }

    /// <summary>
    /// 线路号
    /// </summary>
    public string? Line { get; set; }
}

public record CentreDataListDetailRequest : PagedKeywordRequest
{
    /// <summary>
    /// 用户id
    /// </summary>
    public string? UserId { get; set; }

    /// <summary>
    /// 类型
    /// </summary>
    public string? FieldName { get; set; }

    /// <summary>
    /// 编号
    /// </summary>
    public string? No {  get; set; }

    /// <summary>
    /// 标题
    /// </summary>
    public string? Title {  get; set; }
}