using IRaCIS.Core.Domain.Share;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IRaCIS.Core.Application.Service.Reading.Dto
{
    public class GetHistoryGlobalInfoOutDto
    {
        public Guid VisitTaskId { get; set; }

        public string TaskName { get; set; }

        public ReadingTaskState ReadingTaskState { get; set; }

        public decimal VisitTaskNum { get; set; }
    }

    public class GetHistoryGlobalInfoInDto
    {
        public Guid VisitTaskId { get; set; }
    }


    public class SubmitOncologyReadingInfoInDto
    {
        public Guid OncologyTaskId { get; set; }
    }

    public class SubmitGlobalReadingInfoInDto
    {
        public Guid GlobalTaskId { get; set; }
    }

    public class SetOncologyQuestion
    {
        public Guid VisitTaskId { get; set; }

        /// <summary>
        /// 评估结果
        /// </summary>
        public string EvaluationResult { get; set; } = string.Empty;

        /// <summary>
        /// 评估原因
        /// </summary>
        public string EvaluationReason { get; set; } = string.Empty;
    }

    public class SetOncologyReadingInfoInDto
    {
        public Guid OncologyTaskId { get; set; }

        public List<SetOncologyQuestion> OncologyQuestionList { get; set; }
    }

    public class SaveGlobalReadingInfoInDto
    {
        public Guid GlobalTaskId { get; set; }

        public Guid SubjectId { get; set; }

        public Guid TrialId { get; set; }

        public List<SaveGlobalReadingQuestion> QuestionList { get; set; }

    }


    public class SaveGlobalReadingQuestion
    {
        public Guid? QuestionId { get; set; }

        public Guid VisitTaskId { get; set; }

        public string Answer { get; set; }
    }


    public class OncologyQuestion
    {
        public Guid QuestionId { get; set; }

        public string QuestionName { get; set; }

        public string Answer { get; set; }
    }

    public class OncologyVisitTaskInfo
    {
        public Guid VisitTaskId { get; set; }

        public string VisitName { get; set; }

        /// <summary>
        /// 评估结果
        /// </summary>
        public string EvaluationResult { get; set; } = string.Empty;

        /// <summary>
        /// 评估原因
        /// </summary>
        public string EvaluationReason { get; set; } = string.Empty;


        public List<OncologyQuestion> QuestionList { get; set; } = new List<OncologyQuestion>();

    }

    public class GetOncologyReadingInfoOutDto
    {
        public Guid OncologyTaskId { get; set; }

        /// <summary>
        /// 评估结果
        /// </summary>
        public string TrialEvaluationResult { get; set; } = string.Empty;

        /// <summary>
        /// 评估原因
        /// </summary>
        public string TrialEvaluationReason { get; set; } = string.Empty;

        //任务阅片状态
        public ReadingTaskState ReadingTaskState { get; set; }

        public List<OncologyVisitTaskInfo> OncologyVisits { get; set; } = new List<OncologyVisitTaskInfo>();
    }

    public class GetOncologyReadingInfoInDto
    {
        public Guid VisitTaskId { get; set; }
    }

    public class GetGlobalReadingInfoInDto
    {
        public Guid VisitTaskId { get; set; }

        /// <summary>
        /// 当新答案为空的时候 是否是有原数据
        /// </summary>
        public bool UsingOriginalData { get; set; } = false;
    }

    public class GetGlobalReadingInfoOutDto
    {
        public Guid GlobalTaskId { get; set; }

        public ReadingTaskState ReadingTaskState { get; set; }

        public List<GlobalVisitInfo> TaskList { get; set; }
    }

    public class GlobalVisitInfo
    {
        public string VisitName { get; set; }

        public Guid VisitId { get; set; }

        public Guid VisitTaskId { get; set; }

        public decimal VisitNum { get; set; }

        public Arm ArmEnum { get; set; }

        public List<GlobalQuestionInfo> BeforeQuestionList { get; set; }

        public List<GlobalQuestionInfo> AfterQuestionList { get; set; }
    }


    public class GlobalQuestionInfo
    {
        public Guid? QuestionId { get; set; }

        public bool IsHaveChange { get; set; } = false;

        public string QuestionName { get; set; }

        public string Answer { get; set; }


      

        /// <summary>
		/// 答案分组
		/// </summary>
		public string AnswerGroup { get; set; } = string.Empty;

        /// <summary>
        /// 答案组合
        /// </summary>
        public string AnswerCombination { get; set; } = string.Empty;

        /// <summary>
        /// 裁判类型
        /// </summary>
        public JudgeTypeEnum JudgeType { get; set; }

        /// <summary>
        /// 类型值
        /// </summary>
        public string TypeValue { get; set; }

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

    public class GetReadingImgOutDto
    {
        public string Path { get; set; }

        public string FileName { get; set; }
    }

    public class SubjectTask
    {
        public Guid SubjectId { get; set; }

        public int UnReadTaskCount { get; set; }

        public int Index { get; set; }
    }


    public class GetNextTaskInDto
    {
        public Guid? SubjectId { get; set; }

        public string SubjectCode { get; set; }=string.Empty;

        public Guid TrialId { get; set; }


        public Guid? VisistTaskId { get; set; }
    }

    public class GetReadingTaskDto
    {
        public Guid VisitTaskId { get; set; }
        public Guid VisistId { get; set; }

        public string TaskBlindName { get; set; }

        public Guid SubjectId { get; set; }

        public string SubjectCode { get; set; }=String.Empty;

        public ReadingCategory ReadingCategory { get; set; }

        public decimal VisitNum { get; set; }

        public bool IsReadingShowSubjectInfo { get; set; } = false;

        public bool IsReadingShowPreviousResults { get; set; } = false;

    }

    public class GetReadingImgInDto
    {

        public Guid? SubjectId { get; set; }

        [NotDefault]
        public Guid TrialId { get; set; }

        public Guid? VisistTaskId { get; set; }
    }

    public class GetConfirmCriterionInDto
    {
        [NotDefault]
        public Guid TrialId { get; set; }
    }



    /// <summary>
    /// 返回对象
    /// </summary>
    public class GetTrialConfirmCriterionListOutDto
    {
        public Guid ReadingQuestionCriterionTrialId { get; set; }

        /// <summary>
        /// 标准
        /// </summary>
        public string ReadingQuestionCriterionTrialName { get; set; }
    }


    public class SetTrialCriterionJudgeQuestionAnswerGroupInDto
    {
        [NotDefault]
        public Guid ReadingQuestionTrialId { get; set; }


        
        public List<string> AnswerGroup { get; set; }

      
        public List<AnswerCombinationDto> AnswerCombination { get; set; }


        
        public JudgeTypeEnum JudgeType { get; set; }
    }

    public class GetTrialCriterionJudgeQuestionListOutDto
    {
        public Guid ReadingQuestionTrialId { get; set; }
        
        public string QuestionName { get; set; }


        public string PageName { get; set; }


        public string TypeValue { get; set; }

        /// <summary>
        /// 裁判类别
        /// </summary>
        public JudgeTypeEnum JudgeType { get; set; }

        /// <summary>
        /// 答案分组
        /// </summary>
        public List<string> AnswerGroup { get; set; }

        /// <summary>
        /// 答案组合
        /// </summary>
        public List<AnswerCombinationDto> AnswerCombination { get; set; }


    }

    public class GetTrialCriterionJudgeQuestionListInDto
    {
        [NotDefault]
        public Guid TrialId { get; set; }

        [NotDefault]
        public Guid ReadingQuestionCriterionTrialId { get; set; }
    }

    public class VisitTaskArm
    {
        public Arm ArmEnum { get; set; }


        public Guid VisitTaskId { get; set; }
    }

    public class GetJudgeReadingInfoOutDto
    {
       public Guid? JudgeResultTaskId { get; set; }

       public List<JudgeReadingInfoDto> VisitInfoList { get; set; }
       
       public List<VisitTaskArm> VisitTaskArmList { get; set; }


        public ReadingTaskState ReadingTaskState { get; set; }

        /// <summary>
        /// 裁判结果的备注
        /// </summary>
        public string JudgeResultRemark { get; set; }


        public string JudgeResultImagePath { get; set; } = string.Empty;
    }

    public class GetReadingPastResultListOutDto
    {
        public Guid VisitTaskId { get; set; }
        public string TaskName { get; set; }

        public string TaskBlindName { get; set; }

        public decimal VisitTaskNum { get; set; }
    }

    public class GetJudgeReadingPastResultListInDto
    {
        [NotDefault]
        public Guid VisitTaskId { get; set; }
    }

    public class GetReadingPastResultListInDto
    {
        [NotDefault]
        public Guid VisitTaskId { get; set; }
    }

    public class SaveJudgeVisitTaskResult
    {
        public Guid VisitTaskId { get; set; }

        public Guid JudgeResultTaskId { get; set; }

        public string JudgeResultRemark { get; set; } = string.Empty;

        public string JudgeResultImagePath { get; set; } = string.Empty;
    }

    public class GetReadingSubjectInfoOutDto
    {
        public Guid VisitTaskId { get; set; }

        public Guid SubjectId { get; set; }

        public string SubjectCode { get; set; } = string.Empty;

        public ReadingCategory ReadingCategory { get; set; }

        public string TaskBlindName { get; set; } = string.Empty;

        public bool IsReadingShowPreviousResults { get; set; } = false;

        public bool IsReadingShowSubjectInfo { get; set; } = false;
    }

    public class GetReadingSubjectInfoInDto
    {
        public Guid VisitTaskId { get; set; }
    }
    public class GetJudgeReadingInfo
    {
        public Guid VisitTaskId { get; set; }
    }

    public class JudgeReadingInfoDto
    {
        public string VisitName { get; set; }

        public Guid VisitId { get; set; }

     
      
        public List<JudgeReadingQuestion> VisitTaskInfoList { get; set; }


    }


    public class JudgeReadingQuestion
    {
        public Arm ArmEnum { get; set; }


        public Guid GlobalVisitTaskId { get; set; }

        public Guid VisitTaskId { get; set; }

        public List<JudgeQuestion> JudgeQuestionList { get; set; }
    }

    public class JudgeQuestion
    {
        public Guid QuestionId { get; set; }


        public string QuestionName { get; set; }

        public dynamic Answer { get; set; }

        public JudgeReadingQuestionType QuestionType { get; set; } = JudgeReadingQuestionType.Question;

    }

    public class GetSystemReadingQuestionInDto
    {
        [NotDefault]
        public Guid Id { get; set; }

      
    }

    public class GetTrialReadingQuestionInDto
    {
        [NotDefault]
        public Guid ReadingQuestionCriterionTrialId { get; set; }

        public Guid? VisitTaskId { get; set; }


        public FormType? FormType { get; set; }
    }

    /// <summary>
    /// 
    /// </summary>
    public class SubmitVisitTaskQuestionsInDto
    {
        [NotDefault]
        public Guid TrialId { get; set; }
        [NotDefault]
        public Guid VisitTaskId { get; set; }
        [NotDefault]
        public Guid ReadingQuestionCriterionTrialId { get; set; }

        public List<QuestionAnswer> AnswerList { get; set; } = new List<QuestionAnswer>();

        
    }

    public class SaveJudgeTaskDto
    {
        public List<Guid> VisitTaskIds { get; set; }
    }

    public class QuestionAnswer
    {
        public Guid ReadingQuestionTrialId { get; set; }

        public string Answer { get; set; }
    }


    //public class GetTrialReadingQuestionDto
    //{
    //    public Guid Id { get; set; }

    //    public string GroupName { get; set; }

    //    List<GetTrialReadingQuestionOutDto> Questions { get; set; }
    //}

    public class GroupTaskAnswerDto
    {
        public Guid QuestionId { get; set; }

        public string AnswerGroup { get; set; }


        public string AnswerCombination { get; set; }

        public JudgeTypeEnum JudgeType { get; set; }

        public List<string> TaskAnswerList { get; set; }
    }

    public class TaskGroupAnswer
    {
        public string Answer { get; set; }
    }

    public class AnswerGroup
    {
        public Guid GroupId { get; set; }

        public string GroupValue { get; set; }
    }


    public class AnswerCombinationDto
    {
        public List<string> AnswerGroupA { get; set; }

        public List<string> AnswerGroupB { get; set; }
    }

    public class TaskAnswerDto
    {
        public Guid VisitTaskId { get; set; }

        public Guid QuestionId { get; set; }

        public string Answer { get; set; }

        public string AnswerGroup { get; set; }

        public string AnswerCombination { get; set; }

        public JudgeTypeEnum JudgeType { get; set; }
    }


    public class GetTrialReadingQuestionPageDto
    {
        public List<GetTrialReadingQuestionOutDto> SinglePage { get; set; }

        public List<GetTrialReadingQuestionOutDto> MultiPage { get; set; }

        public List<GetTrialReadingQuestionOutDto> PublicPage{ get; set; }
    }
    public class GetTrialReadingQuestionOutDto
    {
        public Guid ReadingQuestionTrialId { get; set; }

        /// <summary>
        /// 项目标准Id
        /// </summary>
        public Guid ReadingQuestionCriterionTrialId { get; set; }

        /// <summary>
        /// 项目Id
        /// </summary>
        public Guid TrialId { get; set; }

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

        /// <summary>
        /// 父问题触发
        /// </summary>
        public string ParentTriggerValue { get; set; }

        public string GroupName { get; set; }

        /// <summary>
        /// 问题名称
        /// </summary>
        public string QuestionName { get; set; }

        /// <summary>
        /// 是否是必须
        /// </summary>
        public bool IsRequired { get; set; }

        /// <summary>
        /// 排序
        /// </summary>
        public int ShowOrder { get; set; }


        public int? PageShowOrder { get; set; }

        /// <summary>
        /// 父问题ID
        /// </summary>
        public Guid? ParentId { get; set; }


        /// <summary>
        /// 类型值
        /// </summary>
        public string TypeValue { get; set; }

        /// <summary>
        /// 答案
        /// </summary>
        public string Answer { get; set; }

        /// <summary>
        /// 分页名称
        /// </summary>
		public string? PageName { get; set; }


        public bool? IsPublicPage { get; set; }

        public bool IsPage { get; set; } = false;

        /// <summary>
		/// 标准分页Id
		/// </summary>
		public Guid? ReadingCriterionPageId { get; set; }

        public List<GetTrialReadingQuestionOutDto> Childrens { get; set; }
    }


}
