using IRaCIS.Core.Domain.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;


namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
{
    public class TrialSiteConfigration : IEntityTypeConfiguration<TrialSite>
    {


        public void Configure(EntityTypeBuilder<TrialSite> builder)
        {
            //从 TrialSite 导航到TrialUserSite （Site下负责的CRC用户 ）会用两个建  trial Site列表会用到
            builder
           .HasMany(s => s.CRCUserList)
            .WithOne(c => c.TrialSite)
            .HasForeignKey(s => new { s.TrialId, s.SiteId })
            .HasPrincipalKey(c => new { c.TrialId, c.SiteId });

        }
    }


    //public class SubjectCriteriaEvaluationVisitFilterConfigration : IEntityTypeConfiguration<SubjectCriteriaEvaluationVisitFilter>
    //{


    //    public void Configure(EntityTypeBuilder<SubjectCriteriaEvaluationVisitFilter> builder)
    //    {
    //        builder
    //       .HasMany(s => s.SubjectCriterionTaskList)
    //        .WithOne(c => c.SubjectCriteriaEvaluationVisitFilter)
    //        .HasForeignKey(s => new { s.SubjectId, s.TrialReadingCriterionId })
    //        .HasPrincipalKey(c => new { c.SubjectId, c.TrialReadingCriterionId });

    //    }
    //}
}
