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 FMPanelBelongRoleMap : APTEntityBaseMap<T_FM_PANEL_BELONG_ROLE>
    {
		public override void Configure(EntityTypeBuilder<T_FM_PANEL_BELONG_ROLE> builder)
		{
			base.Configure(builder);
			builder.HasOne(t => t.Nav_BelongRole).WithMany(t => t.Nav_Panels).HasForeignKey(t => t.BELONG_ROLE_ID).OnDelete(DeleteBehavior.Restrict);
			builder.HasOne(t => t.Nav_Panel).WithMany().HasForeignKey(t => t.PANEL_ID).OnDelete(DeleteBehavior.Restrict);
		} 
    }
}
