using Hotline.Settings.Hotspots;
using Hotline.Share.Dtos;
using Hotline.Share.Dtos.Order;
using Hotline.Share.Enums.Order;
using SqlSugar;
using XF.Domain.Repository;
using XF.Utility.EnumExtensions;

namespace Hotline.Orders
{
    [SugarIndex("index_visitDetail_creationtime", nameof(OrderVisitDetail.CreationTime), OrderByType.Desc)]
    [SugarIndex("index_visitDetail_visitId", nameof(OrderVisitDetail.VisitId), OrderByType.Desc)]
    [SugarIndex("index_visitDetail_visitOrgCode", nameof(OrderVisitDetail.VisitOrgCode), OrderByType.Desc)]
    public class OrderVisitDetail : CreationEntity
    {

        /// <summary>
        /// 回访主表ID
        /// </summary>
        public string VisitId { get; set; }

        [Navigate(NavigateType.OneToOne, nameof(VisitId))]
        public OrderVisit OrderVisit { get; set; }

        /// <summary>
        /// 二次办理申请
        /// </summary>
        [Navigate(NavigateType.OneToOne, nameof(Id), nameof(OrderSecondaryHandling.VisitDetailId))]
        public OrderSecondaryHandling SecondaryHandling { get; set; }

        /// <summary>
        /// 甄别记录
        /// </summary>
        [Navigate(NavigateType.OneToMany, nameof(OrderScreen.VisitDetailId), nameof(Id))]
        public List<OrderScreen> OrderScreens { get; set; }

        /// <summary>
        /// 语音评价（话务评价）
        /// </summary>
        public EVoiceEvaluate? VoiceEvaluate { get; set; }

        /// <summary>
        /// 话务员评价（话务评价）
        /// </summary>
        public ESeatEvaluate? SeatEvaluate { get; set; }

        /// <summary>
        /// 是否联系
        /// </summary>
        public bool? IsContact { get; set; }

        /// <summary>
        /// 处理结果
        /// </summary>
        public bool? Volved { get; set; }

        /// <summary>
        /// 未处理内容
        /// </summary>
        public string? VolveConent { get; set; }

        /// <summary>
        /// 部门办件结果
        /// </summary>
        [SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true)]
        public Kv? OrgProcessingResults { get; set; }

        /// <summary>
        /// 不满意原因
        /// </summary>
        [SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true)]
        public List<Kv>? OrgNoSatisfiedReason { get; set; }

        /// <summary>
        /// 部门办件态度
        /// </summary>
        [SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true)]
        public Kv? OrgHandledAttitude { get; set; }

        /// <summary>
        /// 回访内容
        /// </summary>
        [SugarColumn(ColumnDataType = "varchar(8000)")]
        public string? VisitContent { get; set; }

        /// <summary>
        /// 回访部门Code
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string VisitOrgCode { get; set; }

        /// <summary>
        /// 回访部门名称
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string VisitOrgName { get; set; }

        /// <summary>
        /// 回访对象类型 10：话务员 20：部门
        /// </summary>
        public EVisitTarget VisitTarget { get; set; }

        /// <summary>
        /// 截至甄别时间
        /// </summary>
        public DateTime? ScreenByEndTime { get; set; }

        ///// <summary>
        ///// 查询数据用
        ///// </summary>
        //[SugarColumn(IsIgnore = true)]
        //public bool? IsShowOperate { get; set; }

    }
}
