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

namespace Nop.Data.Mapping.CatalogB2C
{
    public partial class ProductVideoMap : NopEntityTypeConfiguration<ProductVideo>
    {
        #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<ProductVideo> builder)
        {
            builder.ToTable(NopMappingDefaults.ProductVideoTable);

            builder.HasOne(productVideo => productVideo.Product)
                .WithMany(product => product.ProductVideos)
                .HasForeignKey(productVideo => productVideo.ProductId)
                .IsRequired();

            base.Configure(builder);
        }

        #endregion
    }
}
