using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Nop.Core.Domain.TopicSideMenu;

namespace Nop.Data.Mapping.Catalog
{
    /// <summary>
    /// Represents a category mapping configuration
    /// </summary>
    public partial class TopicSideMenuMappingMap : NopEntityTypeConfiguration<TopicSideMenuMapping>
    {
        #region Methods

        /// <summary>
        /// Configures the entity
        /// </summary>
        /// <param name="builder">The builder to be used to configure the entity</param>
        public override void Configure(EntityTypeBuilder<TopicSideMenuMapping> builder)
        {
            builder.ToTable(nameof(TopicSideMenuMapping));
            builder.HasKey(x => x.Id);

            builder.HasOne(x => x.Topics)
                  .WithMany()
                  .HasForeignKey(x => x.TopicId);


            builder.HasOne(x => x.TopicSideMenu)
                 .WithMany()
                 .HasForeignKey(x => x.TopicSideMenuId);

            base.Configure(builder);
        }

        #endregion
    }
}