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 ReadingPeriodSetAddOrEdit 
    {
        public new Guid? Id { get; set; }

        /// <summary>
        /// 项目ID
        /// </summary>
        [NotDefault]
        public Guid TrialId { get; set; }

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

        /// <summary>
        /// 阅片期名称
        /// </summary>
        public string ReadingPeriodName { get; set; }


        /// <summary>
        /// 阅片范围
        /// </summary>
        public ReadingScopeEnum? ReadingScope { 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>
        /// 是否生效
        /// </summary>
        public ReadingPeriodStatus IsTakeEffect { get; set; } = ReadingPeriodStatus.NotTakeEffect;

        public ReadingSetType ReadingSetType { get; set; } = ReadingSetType.ImageReading;

        public  List<Guid> SiteIds { get; set; }  = new List<Guid>();

        public  List<Guid> SubjectVisitIds { get; set; } = new List<Guid>();

    }


    public class ReadingToGenerateInDto
    {
        /// <summary>
        /// 阅片期ID
        /// </summary>

        public Guid ReadingPeriodSetId { get; set; }

        /// <summary>
        /// 访视ID
        /// </summary>
        public List<Guid> SubjectVisitIds { get; set; }
    }

    public class PreviewTheReadingListDto : PageInput
    {
        /// <summary>
        /// 阅片期ID
        /// </summary>

        public Guid ReadingPeriodSetId { get; set; }
    }

    public class PreviewTheReadingListInDto : PageInput
    {
        /// <summary>
		/// 阅片范围
		/// </summary>
		public ReadingScopeEnum ReadingScope { get; set; }

        /// <summary>
        /// 中心ID
        /// </summary>
        public List<Guid> SiteIds { get; set; } = new List<Guid>();

        /// <summary>
        /// 项目ID
        /// </summary>
        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>
        /// 阅片期名称
        /// </summary>
        public string ReadingPeriodName { get; set; }

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

        public Guid? TrialReadingCriterionId { get; set; }



    }

    /// <summary>
    /// 获取影像阅片预览的Dto
    /// </summary>
    public class PreviewTheReadingListOutDto
    {
        public Guid Id { get; set; }

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

        /// <summary>
        /// 访视Id
        /// </summary>
        public Guid SubjectVisitId { get; set; }

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

        /// <summary>
        /// 受试者名称
        /// </summary>
        public string SubjectCode { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        /// 最晚拍片日期
        /// </summary>
        public DateTime? LatestScanDate { get; set; }

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

        /// <summary>
        /// 阅片期ID
        /// </summary>

        public Guid? ReadingPeriodSetId { get; set; }

        /// <summary>
        /// 阅片期名称
        /// </summary>
        public string ReadingPeriodName { get; set; }

        public string SubjectVisitName { get; set; }

        public DateTime? EffectOfTime { get; set; }


    }

    public class ReadingPeriodSetView
    {
        /// <summary>
        /// id
        /// </summary>

        public Guid Id { get; set; }

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

        /// <summary>
        /// 阅片期名称
        /// </summary>
        public string ReadingPeriodName { get; set; }

        /// <summary>
        /// 阅片范围
        /// </summary>
        public ReadingScopeEnum? ReadingScope { 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>
        /// 是否生效
        /// </summary>
        public int? IsTakeEffect { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 生效时间
        /// </summary>
        public DateTime? EffectOfTime { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        public Guid CreateUserId { get; set; }

        public string? SubjectVisitName { get; set; }

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

        /// <summary>
        /// 中心Id
        /// </summary>
        public List<Guid> SiteIds { get; set; }

        /// <summary>
        /// 中心name
        /// </summary>
        public List<string> SiteCodes { get; set; }

        /// <summary>
        /// 计划条数
        /// </summary>
        public int PlanCount { get; set; }

        public bool IsGlobal { get; set; }

    }

    public class GetReadingVisitListOutDto
    {
        public Guid VisitStageId { get; set; }
        public decimal VisitNum { get; set; }
        public string VisitName { get; set; } = string.Empty;
    }

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

        /// <summary>
        /// 配置ID
        /// </summary>
        public Guid? ReadingPeriodSetId { get; set; }


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

        public Guid? TrialReadingCriterionId { get; set; }
    }


    public class SetReadingPeriodSetEffect
    {
        /// <summary>
        /// 项目ID
        /// </summary>
        public Guid Id { get; set; }

        /// <summary>
        /// 设置阅片是否生效
        /// </summary>
        public ReadingPeriodStatus IsTakeEffect { get; set; }
    }

    public class ReadingPeriodSetQuery:PageInput
    {

        /// <summary>
		/// 截止访视
		/// </summary>
		public decimal? ExpirationVisitNum { get; set; }

        /// <summary>
		/// 项目ID
		/// </summary>
		[NotDefault]
        public Guid TrialId { get; set; }

        /// <summary>
        /// 阅片期名称
        /// </summary>
        public string? ReadingPeriodName { get; set; }

        public Guid? TrialReadingCriterionId { get; set; }
    }
}
