using Hotline.Share.Requests;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Hotline.Share.Dtos.File
{
	public class FileDto
	{
		/// <summary>
		/// 附件全称
		/// </summary>
		public string FileName { get; set; }

		/// <summary>
		/// 附件名称
		/// </summary>
		public string? Name { get; set; }

		/// <summary>
		/// 附件KEY
		/// </summary>
		public string? Key { get; set; }


		/// <summary>
		/// 附件流程KEY
		/// </summary>
		public string? FlowKey { get; set; }


		/// <summary>
		/// 附件类型
		/// </summary>
		public string? Type { get; set; }

		/// <summary>
		/// 部门ID
		/// </summary>
		public string? OrgId { get; set; }

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

		/// <summary>
		/// 上传人Id
		/// </summary>
		public string? UserId { get; set; }

		/// <summary>
		/// 上传人名称
		/// </summary>
		public string? UserName { get; set; }


		/// <summary>
		/// 是否公开
		/// </summary>
		public int? Publicity { get; set; }


		/// <summary>
		/// 附件分类
		/// </summary>
		public string? Classify { get; set; }

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

		/// <summary>
		/// 附件路径
		/// </summary>
		public string? Path { get; set; }

		/// <summary>
		/// 完整附件路径
		/// </summary>
		public string? AllPath { get; set; }

		/// <summary>
		/// 仅限制附件列表使用字段
		/// </summary>
		public bool IsDelete { get; set; }

		public string? CreatorId { get; set; }


		public bool GetIsDelete(string userId)
		{
			return Classify == "附件列表上传" && userId == CreatorId;
		}

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

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

		public string GetStepName(string name) {

			return StepName = name;
		}

	}
	public class UpdateFileDto : FileDto
	{
		public string Id { get; set; }
	}
	public class DeleteFileDto
	{
		public List<string> Ids { get; set; }
	}

	public record FileListDto : PagedKeywordRequest
	{
		/// <summary>
		/// 附件名称
		/// </summary>
		public string? Name { get; set; }

		/// <summary>
		/// 附件KEY
		/// </summary>
		public string? Key { get; set; }

		/// <summary>
		/// 附件类型
		/// </summary>
		public string? Type { get; set; }


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


		/// <summary>
		/// 是否公开
		/// </summary>
		public int? Publicity { get; set; }


		/// <summary>
		/// 附件分类
		/// </summary>
		public string? Classify { get; set; }

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

		/// <summary>
		/// 附件路径
		/// </summary>
		public string? Path { get; set; }
	}

	public class FileJson
	{

		public string Id { get; set; }

		public string FileName { get; set; }

		public string FileType { get; set; }

		public string FileId { get; set; }

		/// <summary>
		/// 录音文件长度(秒)
		/// </summary>
		public long Duration { get; set; } = 0;

		public string Path { get; set; }
	}
}

