using APT.Infrastructure.EF.Map;
using APT.BaseData.Domain.Entities.FM;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace APT.BaseData.Data.Mapping.FM
{
    public class FMProductProcessMap : APTEntityBaseMap<T_FM_PRODUCT_PROCESS>
    {
        public override void Configure(EntityTypeBuilder<T_FM_PRODUCT_PROCESS> builder)
        {
            base.Configure(builder);
            builder.Property(t => t.CODE).HasMaxLength(30);
            builder.Property(t => t.NAME).HasMaxLength(100);
            builder.Property(t => t.NAME_ACRONYM).HasMaxLength(200);
            builder.Property(t => t.REMARK).HasMaxLength(500);
            builder.HasOne(t => t.Nav_FQCWorkStage).WithMany().HasForeignKey(t => t.FQC_WORKSTAGE_ID);
            builder.HasOne(t => t.Nav_PQCWorkStage).WithMany().HasForeignKey(t => t.PQC_WORKSTAGE_ID);
            builder.HasOne(t => t.Nav_Product).WithMany(t => t.Nav_ProductProcesses).HasForeignKey(t => t.PRODUCT_ID);
            builder.HasOne(t => t.Nav_User).WithMany().HasForeignKey(t => t.MODIFIER_ID);
            builder.HasOne(t => t.Nav_Process).WithMany().HasForeignKey(t => t.PROCESS_ID);
        }
    }
}
