using MiniExcelLibs.Attributes;
using System.ComponentModel.DataAnnotations;

namespace IRaCIS.Application.Contracts
{
    public class VisitStageSelectDTO
    {
        public Guid Id { get; set; }

        public decimal VisitNum { get; set; }

        public string VisitName { get; set; } = String.Empty;
        public int VisitDay { get; set; }


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

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

        public int VisitWindowLeft { get; set; }
        public int VisitWindowRight { get; set; }
    }

    public class VisitStageDTO : VisitPlanCommand
    {
        public DateTime CreateTime { get; set; }

        public bool IsHaveFirstConfirmed { get; set; }

    }

    public class VisitPlanView
    {
        public List<VisitStageDTO> VisitPlanList = new List<VisitStageDTO>();

        public decimal TimePointsPerPatient { get; set; }
        public bool VisitPlanConfirmed { get; set; }

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

        public string BlindBaseLineName { get; set; }

        public string BlindFollowUpPrefix { get; set; }

        public bool IsHaveGeneratedTask { get; set; }
    }


    public class VisitBlindNameCommand
    {
        [NotDefault]
        public Guid TrialId { get; set; }
        public string BlindBaseLineName { get; set; }

        public string BlindFollowUpPrefix { get; set; }
    }



    public class VisitPlanCommand
    {
        //public string BlindName => "B" + (VisitNum * 10).ToString("D3");

        public string BlindName { get; set; } = String.Empty;
        public bool IsConfirmed { get; set; } = false;

        public Guid? Id { get; set; }
        public Guid TrialId { get; set; }

        public decimal VisitNum { get; set; }
        public string VisitName { get; set; } = String.Empty;
        public int VisitDay { get; set; }
        public string Description { get; set; } = String.Empty;
        public bool NeedGlobal { get; set; } = false;

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


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

        public int VisitWindowLeft { get; set; }
        public int VisitWindowRight { get; set; }

        public bool IsDeleted { get; set; }
    }


    public class VisitPlanQueryDTO : PageInput
    {
        public Guid TrialId { get; set; } = Guid.Empty;
        public string Keyword { get; set; } = string.Empty;
    }

    public class VisitPlanInfluenceSubjectVisitStatDTO
    {
        public Guid Id { get; set; }
        public Guid CreateUserId { get; set; }

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

        public DateTime CreateTime { get; set; }

        public int InconsistentCount { get; set; }
    }

    public class VisitPlanInfluenceSubjectVisitDTO
    {
        [ExcelColumn(Ignore = true)]
        public Guid StudyId { get; set; }

        [ExcelColumn(Ignore = true)]
        public Guid TrialId { get; set; }

        [ExcelColumn(Ignore = true)]
        public Guid SubjectVisitId { get; set; }

        [ExcelColumnName("中心编号")]
        public string TrialSiteCode { get; set; } = string.Empty;

        [ExcelColumnName("受试者")]
        public string SubjectCode { get; set; } = string.Empty;

        [ExcelColumnName("访视名称")]
        public string VisitName { get; set; } = string.Empty;

        [ExcelColumn(Name = "检查时间", Format = "yyyy-MM-dd HH:mm:ss")]
        public DateTime StudyTime { get; set; }

        [ExcelColumnName("检查技术")]
        public string Modality { get; set; } = string.Empty;

        [ExcelColumn(Ignore = true)]
        public bool IsDicomStudy { get; set; }


        [ExcelColumnName("影像类型")]
        public string ImageType => IsDicomStudy ? "Dicom" : "非Dicom";

        [ExcelColumnName("历史窗口")]
        public string HistoryWindow { get; set; } = string.Empty;


        [ExcelColumnName("之前超窗调整后没超窗")]

        public bool IsOverWindowNowNotOverWindow { get; set; }

        [ExcelColumnName("目前窗口")]
        public string NowWindow { get; set; } = string.Empty;

        [ExcelColumn(Ignore = true)]
        public DateTime CreateTime { get; set; }
    }


}
