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 FMRoleMenuPermBtnMap : APTEntityBaseMap<T_FM_ROLE_MENU_PERM_BTN>
	{
		public override void Configure(EntityTypeBuilder<T_FM_ROLE_MENU_PERM_BTN> builder)
		{
			base.Configure(builder);

			builder.HasOne(t => t.Nav_RoleMenuPermission).WithMany(t => t.Nav_PermissionBtns)
				.HasForeignKey(t => t.ROLE_MENU_PERMISSION_ID).OnDelete(DeleteBehavior.Restrict);
			builder.HasOne(t => t.Nav_Btn).WithMany().HasForeignKey(t => t.BTN_ID).OnDelete(DeleteBehavior.Restrict);
		} 
	}
}
