using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using wispro.sp.entity;

namespace wispro.sp.datamap
{
    public class VerifyCoefficientMap : IEntityTypeConfiguration<VerifyCoefficient>
    {
        public void Configure(EntityTypeBuilder<VerifyCoefficient> builder)
        {
            builder.HasKey(o => new { o.CheckerId, o.DoPersonId });

            builder.ToTable("VerifyCoefficient");

            builder.Property(e => e.Coefficient).HasColumnType("decimal(18, 0)");

            builder.HasOne(d => d.Checker)
                .WithMany()
                .HasForeignKey(d => d.CheckerId);

            builder.HasOne(d => d.DoPerson)
                .WithMany(p => p.VerifyCoefficientDoPeople)
                .HasForeignKey(d => d.CheckerId);
        }
        
    }
    
}
