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

namespace APT.BaseData.Data.Mapping
{
	public class PFMenuMap : TreeEntityBaseMap<T_PF_MENU>
    {

		public override void Configure(EntityTypeBuilder<T_PF_MENU> builder)
		{
			base.Configure(builder);
			builder.Property(t => t.NAME)
				.HasMaxLength(50);
            builder.Property(t => t.NAME_ACRONYM).HasMaxLength(100);

            builder.Property(t => t.MENU_FORM_PARAMS)
				.HasMaxLength(300);

			builder.Property(t => t.ICON)
			   .HasMaxLength(50);

			builder.Property(t => t.NUM);

			builder.HasOne(t => t.Nav_MenuForm).
				WithMany().HasForeignKey(t => t.MENU_FORM_ID).OnDelete(DeleteBehavior.Restrict);

			builder.HasOne(t => t.Nav_Picture).
			WithMany().HasForeignKey(t => t.PICTURE_ID).OnDelete(DeleteBehavior.Restrict);

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

        }
    }
}
