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 FMRoleMenuPermMap : APTEntityBaseMap<T_FM_ROLE_MENU_PERM>
	{
		public override void Configure(EntityTypeBuilder<T_FM_ROLE_MENU_PERM> builder)
		{
			base.Configure(builder);
			builder.HasOne(t => t.Nav_PermissionForm).WithMany().HasForeignKey(t => t.PERMISSION_FORM_ID).OnDelete(DeleteBehavior.Restrict);
			builder.HasOne(t => t.Nav_Role).WithMany(t => t.Nav_MenuPermissions).
				HasForeignKey(t => t.ROLE_ID).OnDelete(DeleteBehavior.Restrict);
		} 
	}
}
