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

namespace APT.BaseData.Data.Mapping.FM
{
    public class FMLineMap : APTEntityBaseMap<T_FM_LINE>
    {
		public override void Configure(EntityTypeBuilder<T_FM_LINE> builder)
		{
			base.Configure(builder);
            builder.Property(t => t.CODE).HasMaxLength(50);
            builder.Property(t => t.NAME).HasMaxLength(50);
            builder.Property(t => t.NAME_ACRONYM).HasMaxLength(100);
            builder.Property(t => t.LINE_PRINCIPAL).HasMaxLength(50);
            builder.Property(t => t.REMARK).HasMaxLength(500);
            builder.Property(t => t.EXT_PROCEDURE_CODE).HasMaxLength(200);

			#region relation
			builder.HasMany(t => t.Nav_LineStages).WithOne()
				.HasForeignKey(t => t.LINE_ID);
            builder.HasOne(t => t.Nav_Department).WithMany().HasForeignKey(t => t.DEPARTMENT_ID);

            #endregion
        } 
    }
}
