using Hotline.Share.Dtos.File;
using Hotline.Share.Enums.Order;
using Hotline.Share.Enums.Settings;
using XF.Utility.EnumExtensions;

namespace Hotline.Share.Dtos.Order.OrderDelay;

public class OrderDelayDto
{
    /// <summary>
    /// 工单编号（冗余）
    /// </summary>
    public string No { get; set; }

    /// <summary>
    /// 工单ID
    /// </summary>
    public string OrderId { get; set; }

    public OrderDto? Order { get; set; }

    /// <summary>
    /// 延期申请时间
    /// </summary>
    public DateTime ApplyDelayTime { get; set; }

    /// <summary>
    /// 申请部门Code
    /// </summary>
    public string ApplyOrgCode { get; set; }

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

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

    /// <summary>
    /// 
    /// </summary>
    public string? EmployeeName { get; set; }

    /// <summary>
    /// 延期申请时限
    /// </summary>
    public int DelayNum { get; set; }

    /// <summary>
    /// 延期申请单位
    /// </summary>
    public ETimeType DelayUnit { get; set; }

    public string DelayUnitText => DelayUnit.GetDescription();

    /// <summary>
    /// 延期申请理由
    /// </summary>
    public string DelayReason { get; set; }

    /// <summary>
    /// 申请前期满时间
    /// </summary>
    public DateTime? BeforeDelay { get; set; }

    /// <summary>
    /// 申请后期满时间
    /// </summary>
    public DateTime? AfterDelay { get; set; }

    /// <summary>
    /// 审批状态
    /// </summary>
    public EDelayState DelayState { get; set; }

    public string DelayStateText => DelayState.GetDescription();

    /// <summary>
    /// 是否省延期
    /// </summary>
    public bool IsProDelay { get; set; }

    /// <summary>
    /// 流程ID
    /// </summary>
    public string? WorkflowId { get; set; }

    public DateTime CreationTime { get; set; }

    public string Id { get; set; }

    public string? CreatorId { get; set; }

    public string? CreatorName { get; set; }

    public string? CreatorOrgId { get; set; }

    public string? CreatorOrgName { get; set; }

    public int CreatorOrgLevel { get; set; }

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

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

    /// <summary>
    /// 当前办理人
    /// </summary>
    public string? ActualHandlerName { get; set; }

    /// <summary>
    /// 是否可办理
    /// </summary>
    public bool IsCanHandle { get; set; }

    public List<FileDto> Files { get; set; }

    public List<FileJson> FileJson { get; set; }

    /// <summary>
    /// 办理 true  审批 false 
    /// </summary>
    public bool Handle { get; set; }

    /// <summary>
    /// 自动延期次数
    /// </summary>
    public int? AutomaticDelayNum { get; set; }

    /// <summary>
    /// 延期流程当前节点名称(空值表示不该当前操作人办)
    /// </summary>
    public string? DelayCurrentStepName { get; set; }
}