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

namespace ATP.BaseData.Data.Mapping.FM
{
	public class FMProcessPlatformMap : APTEntityBaseMap<T_FM_PROCESS_PLATFORM>
	{
		public override void Configure(EntityTypeBuilder<T_FM_PROCESS_PLATFORM> builder)
		{
			base.Configure(builder);
			builder.Property(t => t.CODE).HasMaxLength(200);
			builder.Property(t => t.NAME).HasMaxLength(200);
			builder.Property(t => t.VERSION).HasMaxLength(400);


			builder.Property(t => t.REMARK).HasMaxLength(400);
			builder.Property(t => t.IMPORTANT_REMARK).HasMaxLength(400);

			builder.Property(t => t.BARREL_TEMPEATURE_1).HasMaxLength(60);
			builder.Property(t => t.BARREL_TEMPEATURE_2).HasMaxLength(60);
			builder.Property(t => t.BARREL_TEMPEATURE_3).HasMaxLength(60);
			builder.Property(t => t.BARREL_TEMPEATURE_4).HasMaxLength(60);
			builder.Property(t => t.BARREL_TEMPEATURE_5).HasMaxLength(60);
			builder.Property(t => t.BARREL_TEMPEATURE_6).HasMaxLength(60);


			builder.HasOne(t => t.Nav_Mould).WithMany().HasForeignKey(t => t.MOULD_ID);
			//builder.HasOne(t => t.Nav_Workstage).WithMany().HasForeignKey(t => t.WORKSTAGE_ID);
			builder.HasOne(t => t.Nav_Product).WithMany().HasForeignKey(t => t.PRODUCT_ID);
			builder.HasOne(t => t.Nav_Mateial).WithMany().HasForeignKey(t => t.MATEIAL_ID);
			builder.HasOne(t => t.Nav_EditUser).WithMany().HasForeignKey(t => t.EDIT_USER_ID);
			builder.HasOne(t => t.Nav_PermitUser).WithMany().HasForeignKey(t => t.PERMIT_USER_ID);
			builder.HasOne(t => t.Nav_ApproveUser).WithMany().HasForeignKey(t => t.APPROVE_USER_ID);
			builder.HasOne(t => t.Nav_Board).WithMany().HasForeignKey(t => t.BOARD_ID);
			builder.HasOne(t => t.Nav_ProcessPlatformParam).WithMany().HasForeignKey(t => t.PROCESS_PLATFORM_PARAM_ID);
		} 
	}
}
