

using System;
using IRaCIS.Core.Domain.Share;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Collections.Generic;
using System.Linq;

namespace IRaCIS.Core.Domain.Models
{
    ///<summary>
    /// 临床资料项目配置
    ///</summary>
    [Table("ClinicalDataTrialSet")]
    public class ClinicalDataTrialSet : Entity, IAuditAdd
    {

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

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

        /// <summary>
        /// 临床级别
        /// </summary>
        public ClinicalLevel ClinicalDataLevel { get; set; }


        /// <summary>
        /// 上传方式
        /// </summary>
        public ClinicalUploadType ClinicalUploadType { get; set; }


        /// <summary>
        /// 系统的ClinicalDataSetId
        /// </summary>
        public Guid? SystemClinicalDataSetId { get; set; }

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

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

        /// <summary>
        /// 是否确认
        /// </summary>
        public bool IsConfirm { get; set; }

        /// <summary>
        /// 上传角色
        /// </summary>
        public UploadRole UploadRole { get; set; }

        /// <summary>
        /// 模板文件名称
        /// </summary>
        public string FileName { get; set; }

        /// <summary>
        /// 文件路径
        /// </summary>
        public string Path { get; set; }

        [JsonIgnore]
        /// <summary>
        /// 
        /// </summary>
        public List<ReadingClinicalData> ReadingClinicalDataList { get; set; }

        [JsonIgnore]

        [ForeignKey("TrialId")]
        public Trial Trial { get; set; }



        [JsonIgnore]
        public List<TrialClinicalDataSetCriterion> TrialClinicalDataSetCriteriaList { get; set; }


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

        public List<int> CriterionEnumList => CriterionEnumListStr.Split('|', StringSplitOptions.RemoveEmptyEntries).Where(t => !string.IsNullOrEmpty(t) && int.TryParse(t.Trim(), out var s)).Select(t => int.Parse(t.Trim())).ToList();

    }






}
