using DataSharing.Share.Dtos;
using DataSharing.Share.Enums;
using Hotline.Share.Dtos.File;
using SqlSugar;
using System.ComponentModel;
using XF.Domain.Repository;

namespace DataSharing.SendTask
{
    /// <summary>
    /// 推送任务数据
    /// </summary>
    [Description("推送任务数据")]
    public class DsSendTask : CreationEntity
    {
        /// <summary>
        /// 省工单编号
        /// </summary>
        [SugarColumn(ColumnDescription = "省工单编号")]
        public string? ProvinceNo { get; set; }

        /// <summary>
        /// 任务优先级(0:最低级别)
        /// </summary>
        [SugarColumn(ColumnDescription = "任务优先级(0:最低级别)")]
        public int TaskPriority { get; set; }

        /// <summary>
        /// 初次推送时间
        /// </summary>
        [SugarColumn(ColumnDescription = "初次推送时间")]
        public DateTime? FirstTime { get; set; }

        /// <summary>
        /// 最近一次推送时间
        /// </summary>
        [SugarColumn(ColumnDescription = "最近一次推送时间")]
        public DateTime? LastTime { get; set; }

        /// <summary>
        /// 推送次数
        /// </summary>
        [SugarColumn(ColumnDescription = "推送次数")]
        public int SendTimes { get; set; }

        /// <summary>
        /// 推送成功
        /// </summary>
        [SugarColumn(ColumnDescription = "推送成功")]
        public bool IsSuccess { get; set; }

        /// <summary>
        /// 平台名称
        /// </summary>
        [SugarColumn(ColumnDescription = "平台名称")]
        public EPlatformSource PlatformSource { get; set; } = EPlatformSource.Province;

        /// <summary>
        /// 任务类型
        /// addOrder, expiredTimeChanged...
        /// </summary>
        [SugarColumn(ColumnDescription = "任务类型")]
        public string TaskType { get; set; }

        /// <summary>
        /// 请求方式
        /// </summary>
        [SugarColumn(ColumnDescription = "请求方式")]
        public string HttpMethod { get; set; }

        /// <summary>
        /// 请求地址
        /// </summary>
        [SugarColumn(ColumnDescription = "请求地址")]
        public string Path { get; set; }

        /// <summary>
        /// 请求参数
        /// </summary>
        [SugarColumn(ColumnDataType = "text", ColumnDescription = "请求参数")]
        public string Request { get; set; }

        /// <summary>
        /// 请求端口，省推送必填，协同或者汇聚
        /// </summary>
        [SugarColumn(ColumnDescription = "请求端口，省推送必填，协同或者汇聚")]
        public EPathType? PathType { get; set; } = EPathType.Other;

        /// <summary>
        /// 生成时间（保存工单创建时间或者通话记录生成时间）
        /// </summary>
        [SugarColumn(ColumnDescription = "生成时间（保存工单创建时间或者通话记录生成时间）", IsNullable = true)]
        public DateTime? GenerationTime { get; set; }

        /// <summary>
        /// 附件
        /// </summary>
        [SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true)]
        public List<FileJson>? FileJson { get; set; }
    }
}
