using Hotline.Share.Dtos.File;
using Hotline.Share.Enums.KnowledgeBase;
using Hotline.Share.Requests;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XF.Utility.EnumExtensions;

namespace Hotline.Share.Dtos.Knowledge
{
	public class KnowledgeCorrectionDto : KnowledgeCorrectionBaseDto
	{
		/// <summary>
		/// 知识库ID
		/// </summary>
		public string KnowledgeId { get; set; }

		/// <summary>
		/// 知识库
		/// </summary>
		public KnowledgeDto Knowledge { get; set; }

		/// <summary>
		/// 知识分类
		/// </summary>
		public List<Kvs> KnowledgeType { get; set; }

		/// <summary>
		/// 纠错内容
		/// </summary>
		public string? Content { get; set; }

		/// <summary>
		/// 答复人名称
		/// </summary>
		public string? ReplyUserName { get; set; }

		/// <summary>
		/// 答复时间
		/// </summary>
		public DateTime? ReplyTime { get; set; }

		/// <summary>
		/// 答复内容
		/// </summary>
		public string? ReplyContent { get; set; }

		/// <summary>
		/// 答复状态
		/// </summary>
		public ECorrectionState State { get; set; } = ECorrectionState.Unanswered;

		public string StateText => State.GetDescription();
	}

	public class KnowledgeCorrectionAddDto
	{
		/// <summary>
		/// 知识库ID
		/// </summary>
		public string KnowledgeId { get; set; }

		/// <summary>
		/// 知识库
		/// </summary>
		public KnowledgeDto Knowledge { get; set; }


		/// <summary>
		/// 纠错内容
		/// </summary>
		public string? Content { get; set; }

		/// <summary>
		/// 答复状态
		/// </summary>
		public ECorrectionState State { get; set; } = ECorrectionState.Unanswered;

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

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

	public class KnowledgeCorrectionUpdateDto : KnowledgeCorrectionAddDto
	{
		public string Id { get; set; }

		/// <summary>
		/// 答复人名称
		/// </summary>
		public string? ReplyUserName { get; set; }

		/// <summary>
		/// 答复时间
		/// </summary>
		public DateTime? ReplyTime { get; set; }

		/// <summary>
		/// 答复内容
		/// </summary>
		public string? ReplyContent { get; set; }

		/// <summary>
		/// 答复状态
		/// </summary>
		public new ECorrectionState State { get; set; } = ECorrectionState.Unanswered;
	}

	public record KnowledgeCorrectionListDto : PagedKeywordRequest
	{
		/// <summary>
		/// 知识分类
		/// </summary>
		public string? KnowledgeTypeId { get; set; }

		/// <summary>
		/// 纠错人
		/// </summary>
		public string? CreatorName { get; set; }
	}
	public class KnowledgeCorrectionBaseDto
	{
		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; }
	}
}
