//---------------------------------------------------------------------------------------------
// This file was AUTO-GENERATED by "EF Domain Objects" Xomega.Net generator.
//
// Manual CHANGES to this file WILL BE LOST when the code is regenerated.
//---------------------------------------------------------------------------------------------

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace AdventureWorks.Services.Entities
{
    public class ProductConfig : IEntityTypeConfiguration<Product>
    {
        public void Configure(EntityTypeBuilder<Product> c)
        {
            c.ToTable("Product", "Production")
             .HasKey(e => e.ProductId);

            // configure relationships

            c.HasOne(e => e.SizeUnitMeasureCodeObject)
             .WithMany()
             .HasForeignKey(e => e.SizeUnitMeasureCode);

            c.HasOne(e => e.WeightUnitMeasureCodeObject)
             .WithMany()
             .HasForeignKey(e => e.WeightUnitMeasureCode);

            c.HasOne(e => e.ProductSubcategoryObject)
             .WithMany()
             .HasForeignKey(e => e.ProductSubcategoryId);

            c.HasOne(e => e.ProductModelObject)
             .WithMany()
             .HasForeignKey(e => e.ProductModelId);

            // configure properties
          
            c.Property(e => e.ProductId)
             .HasColumnName("ProductID")
             .HasColumnType("int")
             .IsRequired()
             .ValueGeneratedOnAdd();

            c.Property(e => e.Name)
             .HasColumnName("Name")
             .HasColumnType("nvarchar")
             .HasMaxLength(50)
             .IsUnicode()
             .IsRequired();

            c.Property(e => e.ProductNumber)
             .HasColumnName("ProductNumber")
             .HasColumnType("nvarchar")
             .HasMaxLength(25)
             .IsUnicode()
             .IsRequired();

            c.Property(e => e.MakeFlag)
             .HasColumnName("MakeFlag")
             .HasColumnType("bit")
             .IsRequired();

            c.Property(e => e.FinishedGoodsFlag)
             .HasColumnName("FinishedGoodsFlag")
             .HasColumnType("bit")
             .IsRequired();

            c.Property(e => e.Color)
             .HasColumnName("Color")
             .HasColumnType("nvarchar")
             .HasMaxLength(15)
             .IsUnicode();

            c.Property(e => e.SafetyStockLevel)
             .HasColumnName("SafetyStockLevel")
             .HasColumnType("smallint")
             .IsRequired();

            c.Property(e => e.ReorderPoint)
             .HasColumnName("ReorderPoint")
             .HasColumnType("smallint")
             .IsRequired();

            c.Property(e => e.StandardCost)
             .HasColumnName("StandardCost")
             .HasColumnType("money")
             .IsRequired();

            c.Property(e => e.ListPrice)
             .HasColumnName("ListPrice")
             .HasColumnType("money")
             .IsRequired();

            c.Property(e => e.Size)
             .HasColumnName("Size")
             .HasColumnType("nvarchar")
             .HasMaxLength(5)
             .IsUnicode();

            c.Property(e => e.SizeUnitMeasureCode)
             .HasColumnName("SizeUnitMeasureCode")
             .HasColumnType("nchar")
             .HasMaxLength(3)
             .IsUnicode()
             .IsFixedLength();

            c.Property(e => e.WeightUnitMeasureCode)
             .HasColumnName("WeightUnitMeasureCode")
             .HasColumnType("nchar")
             .HasMaxLength(3)
             .IsUnicode()
             .IsFixedLength();

            c.Property(e => e.Weight)
             .HasColumnName("Weight")
             .HasColumnType("decimal(8,2)");

            c.Property(e => e.DaysToManufacture)
             .HasColumnName("DaysToManufacture")
             .HasColumnType("int")
             .IsRequired();

            c.Property(e => e.ProductLine)
             .HasColumnName("ProductLine")
             .HasColumnType("nchar")
             .HasMaxLength(2)
             .IsUnicode()
             .IsFixedLength();

            c.Property(e => e.Class)
             .HasColumnName("Class")
             .HasColumnType("nchar")
             .HasMaxLength(2)
             .IsUnicode()
             .IsFixedLength();

            c.Property(e => e.Style)
             .HasColumnName("Style")
             .HasColumnType("nchar")
             .HasMaxLength(2)
             .IsUnicode()
             .IsFixedLength();

            c.Property(e => e.ProductSubcategoryId)
             .HasColumnName("ProductSubcategoryID")
             .HasColumnType("int");

            c.Property(e => e.ProductModelId)
             .HasColumnName("ProductModelID")
             .HasColumnType("int");

            c.Property(e => e.SellStartDate)
             .HasColumnName("SellStartDate")
             .HasColumnType("datetime")
             .IsRequired();

            c.Property(e => e.SellEndDate)
             .HasColumnName("SellEndDate")
             .HasColumnType("datetime");

            c.Property(e => e.DiscontinuedDate)
             .HasColumnName("DiscontinuedDate")
             .HasColumnType("datetime");

            c.Property(e => e.Rowguid)
             .HasColumnName("rowguid")
             .HasColumnType("uniqueidentifier")
             .IsRequired();

            c.Property(e => e.ModifiedDate)
             .HasColumnName("ModifiedDate")
             .HasColumnType("datetime")
             .IsRequired();

        }
    }
}