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 GetReadModuleDto : PageInput
    {
        public Guid? TrialId { get; set; }

        public Guid? SubjectId { get; set; }

        /// <summary>
        /// 项目中心Code
        /// </summary>
        public string? TrialSiteCode { get; set; }

        /// <summary>
        /// 患者Code
        /// </summary>
        public string? SubjectCode { get; set; }

        /// <summary>
        /// 模块类型
        /// </summary>
        public ModuleTypeEnum? ModuleType { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public ReadingStatusEnum? ReadingStatus { get; set; }

        /// <summary>
        /// 任务名称
        /// </summary>
        public string? Name { get; set; }


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

    }

    public class GetSubjectReadVisitsOutDto
    {
        public Guid SubjectVisitId { get; set; }

        public decimal VisitNum { get; set; }

        public string VisitName { get; set; }
    }


    public class GetSubjectReadVisitsInDto
    {
        /// <summary>
        /// 阅片配置的类型
        /// </summary>
        public ReadingSetType ReadingSetType { get; set; }

        /// <summary>
        /// 患者ID
        /// </summary>
        public Guid SubjectId { get; set; }

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

    public class ReadModuleAddDto
    {
        public Guid TrialId { get; set; }

        /// <summary>
        /// 截止日期
        /// </summary>
        public DateTime? ExpirationDate { get; set; }

        /// <summary>
        /// 截止检查批次
        /// </summary>
        public decimal? ExpirationVisitNum { get; set; }

        /// <summary>
        /// 检查批次计划ID
        /// </summary>
        public Guid? VisitStageId { get; set; }

        /// <summary>
        /// 患者ID
        /// </summary>
        public Guid SubjectId { get; set; }

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

        /// <summary>
        /// 阅片配置的类型
        /// </summary>
        public ReadingSetType ReadingSetType { get; set; }

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


    public class ReadModuleAddOrEdit : ReadModule
    {
        public new Guid? Id { get; set; }

    }

    public class VisitFinishReadingAddReadModuleInDto
    {
        /// <summary>
        /// 项目ID
        /// </summary>
        public Guid TrialId { get; set; }

        /// <summary>
        /// 患者Id
        /// </summary>
        public Guid SubjectId { get; set; }

        /// <summary>
        /// 检查批次Id
        /// </summary>
        public Guid SubjectVisitId { get; set; }


    }

    public class GetReadModuleSingleIndto
    {
        public Guid Id { get; set; }

        public Guid SubjectId { get; set; }


        public Guid TrialId { get; set; }

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


    }


    public class GetReadModuleSingleOutdto
    {
        public Guid Id { get; set; }

        /// <summary>
        /// 模块类型
        /// </summary>
        public ModuleTypeEnum ModuleType { get; set; }

        /// <summary>
        /// 检查批次ID
        /// </summary>
        public Guid? SubjectVisitId { get; set; }


        /// <summary>
        /// 检查批次名称
        /// </summary>
        public string SubjectVisitName { get; set; }

        /// <summary>
        /// 干系人Id
        /// </summary>
        public List<Guid> StakeholderIds { get; set; }

        /// <summary>
        /// 干系人姓名
        /// </summary>
        public List<string> StakeholderNames { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public  ReadingStatusEnum Status { get; set; }
    }

 


    public class GetReadModuleResultDto
    {
        /// <summary>
        /// 当前页索引
        /// </summary>
        public int PageIndex { get; set; }

        /// <summary>
        /// 每页的记录条数
        /// </summary>
        public int PageSize { get; set; }

        /// <summary>
        /// 数据总数
        /// </summary>
        public long TotalCount { get; set; } = 0;

        /// <summary>
        /// 最大长度
        /// </summary>
        public int MaxLength { get; set; }

        /// <summary>
        /// 数据
        /// </summary>
        public List<GetReadModuleDtoOut> CurrentPageData { get; set; }
    }


    //public class GetReadModuleDtoOut

    public class GetReadModuleDtoOut
    {
        public string SubjectCode { get; set; }

        public string TrialSiteCode { get; set; }

        public string SiteCode { get; set; }

        public Guid SiteId { get; set; }

        public Guid SubjectId { get; set; }

        public List<ReadModuleView> Data { get; set; }

    }



    public class ReadPlanView
    {
        public string SubjectCode { get; set; }

        public string TrialSiteCode { get; set; }

        public string SiteCode { get; set; }

        public Guid SiteId { get; set; }

        public Guid SubjectId { get; set; }


        public List<SubjectVisitPlanView> SubjectVisitPlanList { get; set; }

        public List<ReadMoudleView> ReadMoudlePlanList { get; set; }
    }

    public class ReadMoudleView
    {     
        public Guid Id { get; set; }
 
        public string Name { get; set; }
    
		public Guid SubjectId { get; set; }

        public ModuleTypeEnum ModuleType { get; set; }


        public bool? IsUrgent { get; set; }


        public Guid SubjectVisitId { get; set; }

        public string SubjectVisitName { get; set; }


        public Guid? CutOffVisitId { get; set; }


        public string? CutOffVisitName { get; set; }


        public Guid? ReadModuleId { get; set; }


        public string? ReadModuleName { get; set; }

        public DateTime CreateTime { get; set; }    

        public bool IsVisit { get; set; }

    }

    public class SubjectVisitPlanView
    {
        /// <summary>
        /// Id(阅片期Id 或者 检查批次ID)
        /// </summary>
        public Guid Id { get; set; }

        public string Name { get; set; }

        public Guid SubjectId { get; set; }

        public ModuleTypeEnum ModuleType { get; set; }


        public bool? IsUrgent { get; set; }

        public Guid SubjectVisitId { get; set; }

        public string SubjectVisitName { get; set; }


        public DateTime CreateTime { get; set; }


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

        public Guid? OutPlanPreviousVisitId { get; set; }

        public string OutPlanPreviousVisitName { get; set; }

        public Guid? SiteId { get; set; }

        public bool IsVisit { get; set; } = true;

        public decimal? VisitNum { get; set; }


        public PDStateEnum PDState { get; set; }

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