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

namespace APT.BaseData.Data.Mapping.FM
{
	public class FMImportConfigFieldMap : APTEntityBaseMap<T_FM_IMPORT_CONFIG_FIELD>
	{
		public override void Configure(EntityTypeBuilder<T_FM_IMPORT_CONFIG_FIELD> builder)
		{
			base.Configure(builder);
			builder.Property(t => t.LABEL).HasMaxLength(100);
			builder.Property(t => t.DEST_FIELD_NAME).HasMaxLength(400);
			builder.Property(t => t.SRC_FIELD_NAME).HasMaxLength(200);
			builder.Property(t => t.ID_FIELD_NAME).HasMaxLength(100);
			builder.Property(t => t.ID_TABLE_NAME).HasMaxLength(100);
			builder.Property(t => t.ID_TABLE_FIELD_NAME).HasMaxLength(400);
			builder.Property(t => t.REMARK).HasMaxLength(400);


			builder.HasOne(t => t.Nav_ImportConfigDetail).WithMany(t => t.Nav_Fields)
				.HasForeignKey(t => t.IMPORT_CONFIG_DETAIL_ID).OnDelete(DeleteBehavior.Restrict);

		} 
	}
}
