using Hotline.Share.Dtos.File;
using Hotline.Share.Enums.Order;
using Hotline.Share.Requests;

namespace Hotline.Share.Dtos.Order
{
	public class OrderSendBackAddDto
	{
		public string OrderId { get; set; }

		/// <summary>
		/// 申请原因
		/// </summary>
		public string? Content { get; set; }

		/// <summary>
		/// 工单
		/// </summary>
		public OrderDto Order { get; set; }

		/// <summary>
		/// 退回目的地
		/// </summary>
		public ESendBackDestination Destination { get; set; }

		/// <summary>
		/// 附件列表
		/// </summary>
		public List<FileDto> Files { get; set; } = new();

	}

	public class BatchOrderSendBackAddDto
	{
		public List<OrdersObserveAddDto> OrderIds { get; set; }

        /// <summary>
        /// 申请原因
        /// </summary>
        public string? Content { get; set; }
    }


    public class AuditOrderSendBackDto 
	{
		public string Id { get; set; }

		/// <summary>
		///  审核结果  0  待审核  1 审核通过  2 审核不通过
		/// </summary>
		public int State { get; set; }

		/// <summary>
		/// 审核意见
		/// </summary>
		public string? AuditOpinion { get; set; }

	}

    public class OrderSendBackDto : OrderSendBackBaseDto
	{
		public string OrderId { get; set; }

		/// <summary>
		/// 默认操作类型 服务工单退回 0
		/// </summary>
		public int Handle { get; set; } = 0;

		/// <summary>
		/// 申请原因
		/// </summary>
		public string? Content { get; set; }

		/// <summary>
		/// 省上退回反馈结果
		/// </summary>
		public int? Result { get; set; }

		/// <summary>
		/// 省上退回反馈
		/// </summary>
		public string? Reason { get; set; }

		/// <summary>
		/// 审核人
		/// </summary>
		public string? AuditName { get; set; }

		/// <summary>
		/// 审核时间
		/// </summary>
		public DateTime? AuditTime { get; set; }

		/// <summary>
		///  审核结果  0  待审核  1 审核通过  2 审核不通过
		/// </summary>
		public int State { get; set; }

		public string StateText => State == 0 ? "待审核" : State == 1 ? "审核通过" : State == 2 ? "审核不通过" : "-";

		/// <summary>
		/// 审核意见
		/// </summary>
		public string? AuditOpinion { get; set; }

		/// <summary>
		/// 工单
		/// </summary>
		public OrderDto Order { get; set; }

		/// <summary>
		/// 退回目的地
		/// </summary>
		public ESendBackDestination Destination { get; set; }

		/// <summary>
		/// 附件
		/// </summary>
		public List<FileJson>? FileJson { get; set; } = new();
	}
	public class OrderSendBackBaseDto
	{
		public DateTime? LastModificationTime { get; set; }

		public bool IsDeleted { get; set; }

		/// <summary>
		/// 删除时间
		/// </summary>
		public DateTime? DeletionTime { get; set; }


		/// <summary>
		/// 创建时间
		/// </summary>
		public DateTime CreationTime { get; set; }

		public string Id { get; set; }

		/// <summary>
		/// 组织Id
		/// </summary>
		public string? CreatorOrgId { get; set; }


		public string? CreatorOrgName { get; set; }

		/// <summary>
		/// 创建人
		/// </summary>
		public string? CreatorId { get; set; }

		public string? CreatorName { get; set; }
	}
	public record OrderSendBackListDto : PagedKeywordRequest
	{
		public DateTime? CreationTimeStart { get; set; }
		public DateTime? CreationTimeEnd { get; set; }

		/// <summary>
		///  审核结果  0  待审核  1 审核通过  2 审核不通过
		/// </summary>
		public int? State { get; set; }
	}

	
	public class PublishOrderSendBackDto
	{
		public List<PublishOrderSendBackModelDto> SendDatas { get; set; }
	}

	public class PublishOrderSendBackModelDto
	{
        // <summary>
        /// 工单对象
        /// </summary>
        public OrderDto Order { get; set; }

        /// <summary>
        /// 退回
        /// </summary>
        public OrderSendBackDto SendBack { get; set; }

        /// <summary>
        /// 附件
        /// </summary>
        public string ClientGuid { get; set; }
    }
}
