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


namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
{
    public class StudyConfigration : IEntityTypeConfiguration<DicomStudy>
    {
       

        public void Configure(EntityTypeBuilder<DicomStudy> builder)
        {
         //   builder
         // .HasMany(s => s.TrialSiteUserList)
         // .WithOne(c => c.DicomStudy)
         //.HasForeignKey(s => new { s.TrialId, s.SiteId })
         //.HasPrincipalKey(c => new { c.TrialId, c.SiteId });


            builder
        .HasOne(s => s.TrialSite)
        .WithMany(c => c.StudyList)
        .HasForeignKey(s => new { s.TrialId, s.SiteId })
        .HasPrincipalKey(c => new { c.TrialId, c.SiteId });

        }
    }
}
