namespace AdvertsingProfitControl
{
    using System;
    using System.Data.Entity;
    using System.ComponentModel.DataAnnotations.Schema;
    using System.Linq;

    public partial class AdvertisingProfitControlModel : DbContext
    {
        public AdvertisingProfitControlModel()
            : base("name=AdvertisingProfitControlDbContext")
        {
        }

        public virtual DbSet<ActualSale> ActualSales { get; set; }
        public virtual DbSet<AdItem> AdItems { get; set; }
        public virtual DbSet<AdSpecial> AdSpecials { get; set; }
        public virtual DbSet<CostAnalysi> CostAnalysis { get; set; }
        public virtual DbSet<Inventory> Inventories { get; set; }
        public virtual DbSet<Invoice> Invoices { get; set; }
        public virtual DbSet<Note> Notes { get; set; }
        public virtual DbSet<Projection> Projections { get; set; }
        public virtual DbSet<Supplier> Suppliers { get; set; }
        public virtual DbSet<Taxable> Taxables { get; set; }
        public virtual DbSet<Version> Versions { get; set; }
        public virtual DbSet<WeekEndingDate> WeekEndingDates { get; set; }
        public virtual DbSet<WeeklySale> WeeklySales { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<ActualSale>()
                .Property(e => e.Sold)
                .IsUnicode(false);

            modelBuilder.Entity<ActualSale>()
                .Property(e => e.SalePrice)
                .IsUnicode(false);

            modelBuilder.Entity<ActualSale>()
                .Property(e => e.TotalSales)
                .HasPrecision(19, 2);

            modelBuilder.Entity<ActualSale>()
                .Property(e => e.Cost)
                .HasPrecision(19, 2);

            modelBuilder.Entity<ActualSale>()
                .Property(e => e.ProfitReturn)
                .HasPrecision(19, 2);

            modelBuilder.Entity<ActualSale>()
                .Property(e => e.TotalProfitReturn)
                .HasPrecision(19, 2);

            modelBuilder.Entity<AdItem>()
                .Property(e => e.Name)
                .IsUnicode(false);

            modelBuilder.Entity<AdItem>()
                .Property(e => e.Description)
                .IsUnicode(false);

            modelBuilder.Entity<AdItem>()
                .HasMany(e => e.ActualSales)
                .WithRequired(e => e.AdItem)
                .HasForeignKey(e => e.FkAdItemId)
                .WillCascadeOnDelete(false);

            modelBuilder.Entity<AdItem>()
                .HasMany(e => e.Inventories)
                .WithRequired(e => e.AdItem)
                .HasForeignKey(e => e.FkAdItemId)
                .WillCascadeOnDelete(false);

            modelBuilder.Entity<AdItem>()
                .HasMany(e => e.Projections)
                .WithRequired(e => e.AdItem)
                .HasForeignKey(e => e.FkAdItemId)
                .WillCascadeOnDelete(false);

            modelBuilder.Entity<AdSpecial>()
                .Property(e => e.Name)
                .IsUnicode(false);

            modelBuilder.Entity<AdSpecial>()
                .Property(e => e.Description)
                .IsUnicode(false);

            modelBuilder.Entity<AdSpecial>()
                .HasMany(e => e.ActualSales)
                .WithOptional(e => e.AdSpecial)
                .HasForeignKey(e => e.FkAdSpecialId);

            modelBuilder.Entity<AdSpecial>()
                .HasMany(e => e.Inventories)
                .WithOptional(e => e.AdSpecial)
                .HasForeignKey(e => e.FkAdSpecialId);

            modelBuilder.Entity<AdSpecial>()
                .HasMany(e => e.Projections)
                .WithOptional(e => e.AdSpecial)
                .HasForeignKey(e => e.FkAdSpecialId);

            modelBuilder.Entity<CostAnalysi>()
                .Property(e => e.SalesPerManHour)
                .HasPrecision(19, 2);

            modelBuilder.Entity<CostAnalysi>()
                .Property(e => e.SalaryPercentage)
                .HasPrecision(19, 2);

            modelBuilder.Entity<CostAnalysi>()
                .Property(e => e.SalaryDollar)
                .HasPrecision(19, 2);

            modelBuilder.Entity<CostAnalysi>()
                .Property(e => e.Supplies)
                .HasPrecision(19, 2);

            modelBuilder.Entity<Inventory>()
                .Property(e => e.BeginningInventory)
                .IsUnicode(false);

            modelBuilder.Entity<Inventory>()
                .Property(e => e.Recieved)
                .IsUnicode(false);

            modelBuilder.Entity<Inventory>()
                .Property(e => e.TotalInventory)
                .IsUnicode(false);

            modelBuilder.Entity<Inventory>()
                .Property(e => e.EndingInventory)
                .IsUnicode(false);

            modelBuilder.Entity<Invoice>()
                .Property(e => e.InvoiceNumber)
                .IsUnicode(false);

            modelBuilder.Entity<Invoice>()
                .Property(e => e.InvoiceNetAmountAtCost)
                .HasPrecision(19, 2);

            modelBuilder.Entity<Invoice>()
                .Property(e => e.InvoiceNetAmount)
                .HasPrecision(19, 2);

            modelBuilder.Entity<Invoice>()
                .Property(e => e.InvoiceNote)
                .IsUnicode(false);

            modelBuilder.Entity<Note>()
                .Property(e => e.Remark)
                .IsUnicode(false);

            modelBuilder.Entity<Projection>()
                .Property(e => e.Sold)
                .IsUnicode(false);

            modelBuilder.Entity<Projection>()
                .Property(e => e.SalePrice)
                .IsUnicode(false);

            modelBuilder.Entity<Projection>()
                .Property(e => e.TotalSales)
                .HasPrecision(19, 2);

            modelBuilder.Entity<Projection>()
                .Property(e => e.Cost)
                .HasPrecision(19, 2);

            modelBuilder.Entity<Projection>()
                .Property(e => e.ProfitReturn)
                .HasPrecision(19, 2);

            modelBuilder.Entity<Projection>()
                .Property(e => e.TotalProfitReturn)
                .HasPrecision(19, 2);

            modelBuilder.Entity<Supplier>()
                .Property(e => e.Name)
                .IsUnicode(false);

            modelBuilder.Entity<Supplier>()
                .Property(e => e.Description)
                .IsUnicode(false);

            modelBuilder.Entity<Supplier>()
                .HasMany(e => e.Invoices)
                .WithRequired(e => e.Supplier)
                .HasForeignKey(e => e.FkSupplierId)
                .WillCascadeOnDelete(false);

            modelBuilder.Entity<Taxable>()
                .Property(e => e.Sunday)
                .HasPrecision(19, 2);

            modelBuilder.Entity<Taxable>()
                .Property(e => e.Monday)
                .HasPrecision(19, 2);

            modelBuilder.Entity<Taxable>()
                .Property(e => e.Tuesday)
                .HasPrecision(19, 2);

            modelBuilder.Entity<Taxable>()
                .Property(e => e.Wednesday)
                .HasPrecision(19, 2);

            modelBuilder.Entity<Taxable>()
                .Property(e => e.Thursday)
                .HasPrecision(19, 2);

            modelBuilder.Entity<Taxable>()
                .Property(e => e.Friday)
                .HasPrecision(19, 2);

            modelBuilder.Entity<Taxable>()
                .Property(e => e.Saturday)
                .HasPrecision(19, 2);

            modelBuilder.Entity<Taxable>()
                .Property(e => e.Total)
                .HasPrecision(19, 2);

            modelBuilder.Entity<Version>()
                .Property(e => e.VersionNumber)
                .IsUnicode(false);

            modelBuilder.Entity<WeekEndingDate>()
                .HasMany(e => e.ActualSales)
                .WithRequired(e => e.WeekEndingDate)
                .HasForeignKey(e => e.FkDateId)
                .WillCascadeOnDelete(false);

            modelBuilder.Entity<WeekEndingDate>()
                .HasMany(e => e.CostAnalysis)
                .WithRequired(e => e.WeekEndingDate)
                .HasForeignKey(e => e.FkDateId)
                .WillCascadeOnDelete(false);

            modelBuilder.Entity<WeekEndingDate>()
                .HasMany(e => e.Inventories)
                .WithRequired(e => e.WeekEndingDate)
                .HasForeignKey(e => e.FkDateId)
                .WillCascadeOnDelete(false);

            modelBuilder.Entity<WeekEndingDate>()
                .HasMany(e => e.Invoices)
                .WithRequired(e => e.WeekEndingDate)
                .HasForeignKey(e => e.FkDateId)
                .WillCascadeOnDelete(false);

            modelBuilder.Entity<WeekEndingDate>()
                .HasMany(e => e.Notes)
                .WithRequired(e => e.WeekEndingDate)
                .HasForeignKey(e => e.FkDateId)
                .WillCascadeOnDelete(false);

            modelBuilder.Entity<WeekEndingDate>()
                .HasMany(e => e.Projections)
                .WithRequired(e => e.WeekEndingDate)
                .HasForeignKey(e => e.FkDateId)
                .WillCascadeOnDelete(false);

            modelBuilder.Entity<WeekEndingDate>()
                .HasMany(e => e.Taxables)
                .WithRequired(e => e.WeekEndingDate)
                .HasForeignKey(e => e.FkDateId)
                .WillCascadeOnDelete(false);

            modelBuilder.Entity<WeekEndingDate>()
                .HasMany(e => e.WeeklySales)
                .WithRequired(e => e.WeekEndingDate)
                .HasForeignKey(e => e.FkDateId)
                .WillCascadeOnDelete(false);

            modelBuilder.Entity<WeeklySale>()
                .Property(e => e.Sunday)
                .HasPrecision(19, 2);

            modelBuilder.Entity<WeeklySale>()
                .Property(e => e.Monday)
                .HasPrecision(19, 2);

            modelBuilder.Entity<WeeklySale>()
                .Property(e => e.Tuesday)
                .HasPrecision(19, 2);

            modelBuilder.Entity<WeeklySale>()
                .Property(e => e.Wednesday)
                .HasPrecision(19, 2);

            modelBuilder.Entity<WeeklySale>()
                .Property(e => e.Thursday)
                .HasPrecision(19, 2);

            modelBuilder.Entity<WeeklySale>()
                .Property(e => e.Friday)
                .HasPrecision(19, 2);

            modelBuilder.Entity<WeeklySale>()
                .Property(e => e.Saturday)
                .HasPrecision(19, 2);

            modelBuilder.Entity<WeeklySale>()
                .Property(e => e.TotalSales)
                .HasPrecision(19, 2);
        }
    }
}
