using IRaCIS.Core.Application.Service.Reading.Dto;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Domain.Share.Reading;
using MassTransit;
using NPOI.POIFS.NIO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IRaCIS.Core.Application.Service
{


    public class CriterionAdditionalAssessment
    {
        public CriterionType CriterionType { get; set; }

        public AdditionalAssessmentType AdditionalAssessmentType { get; set; }

        //附加评估问题
        public List<ReadingQuestionTrial> AdditionalQuestionList { get; set; } = new List<ReadingQuestionTrial>();

    }


    public class AdditionalAssessment
    {

        public List<CriterionAdditionalAssessment> SystemDefeaultAdditionalAssessmentList { get; set; } = new List<CriterionAdditionalAssessment>();
        public AdditionalAssessment()
        {
            //Resist1.1 脑转移 默认评估问题
            {
                var gropId = NewId.NextGuid();

                SystemDefeaultAdditionalAssessmentList.Add(new CriterionAdditionalAssessment()
                {
                    CriterionType = CriterionType.RECIST1Point1,
                    AdditionalAssessmentType = AdditionalAssessmentType.BrainMetastasis,
                    AdditionalQuestionList = new List<ReadingQuestionTrial>(){

                      new ReadingQuestionTrial()
                {
                    LimitEdit=LimitEdit.OnlyBaseLine,
                    Id=gropId,
                    IsJudgeQuestion=false,
                    IsShowInDicom=false,
                    GlobalReadingShowType=GlobalReadingShowType.NotShow,

                    QuestionName="脑转移评估",
                    QuestionEnName="Brain Metastasis Assessment",
                    GroupName="脑转移评估",
                    GroupEnName="Brain Metastasis Assessment",
                    Type="group",
                    QuestionGenre=TableQuestionType.Customize,
                    DataSource=DataSources.ManualEntry,
                    ShowQuestion=ShowQuestion.Show,


                    IsAdditional=true
                } ,

                    new ReadingQuestionTrial()
                {
                     GroupId=gropId,
                    LimitEdit=LimitEdit.OnlyBaseLine,
                    DictionaryCode="YesOrNoOrNa",
                    IsJudgeQuestion=false,
                    IsShowInDicom=false,
                    GlobalReadingShowType=GlobalReadingShowType.NotShow,
                    QuestionEnName="Brain Metastasis Present",
                    QuestionName="存在脑转移",
                    Type="radio",
                    QuestionGenre=TableQuestionType.Dictionary,
                    DataSource=DataSources.ManualEntry,
                    ShowQuestion=ShowQuestion.Show,


                    IsAdditional=true
                } ,

                }
                });
            }

            //Resist1.1 TNM分期
            {

                //var gropId = NewId.NextGuid();

                //SystemDefeaultAdditionalAssessmentList.Add(new CriterionAdditionalAssessment()
                //{
                //    CriterionType = CriterionType.RECIST1Point1,
                //    AdditionalAssessmentType = AdditionalAssessmentType.TNMStage,
                //    AdditionalQuestionList = new List<ReadingQuestionTrial>(){

                //      new ReadingQuestionTrial()
                //{
                //    LimitEdit=LimitEdit.OnlyBaseLine,
                //    Id=gropId,
                //    IsJudgeQuestion=false,
                //    IsShowInDicom=false,
                //    GlobalReadingShowType=GlobalReadingShowType.NotShow,

                //    QuestionName="TNM分期评估",
                //    QuestionEnName="TNM Stage Assessment",
                //    GroupName="TNM分期评估",
                //    GroupEnName="TNM Stage Assessment",
                //    Type="group",
                //    QuestionGenre=TableQuestionType.Customize,
                //    DataSource=DataSources.ManualEntry,
                //    ShowQuestion=ShowQuestion.Show,


                //    IsAdditional=true
                //} ,

                //    new ReadingQuestionTrial()
                //{
                //     GroupId=gropId,
                //    LimitEdit=LimitEdit.OnlyBaseLine,
                //    DictionaryCode="YesOrNoOrNa",
                //    IsJudgeQuestion=false,
                //    IsShowInDicom=false,
                //    GlobalReadingShowType=GlobalReadingShowType.NotShow,
                //    QuestionEnName="Brain metastases present",
                //    QuestionName="存在脑转移",
                //    Type="radio",
                //    QuestionGenre=TableQuestionType.Dictionary,
                //    DataSource=DataSources.ManualEntry,
                //    ShowQuestion=ShowQuestion.Show,


                //    IsAdditional=true
                //} ,

                //}
                //});

            }



        }


        public List<CriterionAdditionalAssessment> GetSystemDefeaultAdditionalAssessmentList(CriterionType criterionType, AdditionalAssessmentType? additionalAssessmentType = null)
        {

            return SystemDefeaultAdditionalAssessmentList.Where(t => t.CriterionType == criterionType)
                .WhereIf(additionalAssessmentType != null, t => t.AdditionalAssessmentType == additionalAssessmentType).ToList();
        }
    }


}
