using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Nop.Core.Domain.BlogsB2C;
using System;
using System.Collections.Generic;
using System.Text;

namespace Nop.Data.Mapping.BlogsB2C
{
    public partial class BlogPostPictureB2CMap : NopEntityTypeConfiguration<BlogPostPictureB2C> 
    {
        #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<BlogPostPictureB2C> builder)
        {
            builder.ToTable(NopMappingDefaults.BlogPostPictureTable);
            builder.HasKey(blogPostPicture => blogPostPicture.Id);

            builder.HasOne(blogPostPicture => blogPostPicture.Picture)
                .WithOne()
                //HasForeignKey(blogPostPicture => blogPostPicture.PictureId)
                .IsRequired();

            builder.HasOne(productPicture => productPicture.BlogPost)
                .WithOne()
                //.HasForeignKey(productPicture => productPicture.ProductId)
                .IsRequired();

            base.Configure(builder);
        }

        #endregion
    }
}
