using Domain;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Infrastructure
{
    public class ShipCertificateEntityTypeConfiguration : IEntityTypeConfiguration<ShipCertificate>
    {
        public void Configure(EntityTypeBuilder<ShipCertificate> builder)
        {
            builder.ToTable("ShipCertificate");

            builder.HasKey(x => x.shipcertificatekey);

            builder.HasOne(s => s.Document).WithMany(g => g.ShipCertificate).HasForeignKey(s => s.documentkey);
            builder.HasOne(x => x.MyShip).WithMany(g => g.ShipCertificate).HasForeignKey(x => x.shipRegisterNoKey);

            builder.Property(x => x.shipcertificatekey).HasColumnName("shipcertificatekey");
            builder.Property(x => x.shipRegisterNoKey).HasColumnName("shipRegisterNoKey");
            builder.Property(x => x.documentkey).HasColumnName("documentkey");
            builder.Property(x => x.certificateno).HasColumnName("certificateno");
         
        }
    }
}
