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.System
{
	public class FMRoleMenuPermColMap : APTEntityBaseMap<T_FM_ROLE_MENU_PERM_COL>
	{
		public override void Configure(EntityTypeBuilder<T_FM_ROLE_MENU_PERM_COL> builder)
		{
			base.Configure(builder);

			builder.HasOne(t => t.Nav_RoleMenuPermission).WithMany(t => t.Nav_PermissionColumns)
				.HasForeignKey(t => t.ROLE_MENU_PERMISSION_ID);
			builder.HasOne(t => t.Nav_Column).WithMany().HasForeignKey(t => t.COLUMN_ID).OnDelete(DeleteBehavior.Restrict);
		} 
	}
}
