// <auto-generated />
using System;
using DiplomovaPrace.Entity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

namespace DiplomovaPrace.Entity.Migrations
{
    [DbContext(typeof(DiplomovaPraceDbContext))]
    [Migration("20210610134005_MadeLoginAccountIDInOrdeNnullable")]
    partial class MadeLoginAccountIDInOrdeNnullable
    {
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("Relational:MaxIdentifierLength", 128)
                .HasAnnotation("ProductVersion", "5.0.5")
                .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

            modelBuilder.Entity("DiplomovaPrace.Model.Orders.Address", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

                    b.Property<int>("AddressTypeID")
                        .HasColumnType("int");

                    b.Property<string>("City")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("nvarchar(100)");

                    b.Property<DateTime?>("Deleted")
                        .HasColumnType("datetime2");

                    b.Property<string>("FirstName")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("nvarchar(100)");

                    b.Property<string>("LastName")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("nvarchar(100)");

                    b.Property<int>("LoginAccountID")
                        .HasColumnType("int");

                    b.Property<string>("PhoneNumber")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("nvarchar(20)");

                    b.Property<string>("State")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("nvarchar(100)");

                    b.Property<string>("Street")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("nvarchar(100)");

                    b.Property<string>("ZipCode")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("nvarchar(20)");

                    b.HasKey("ID");

                    b.HasIndex("AddressTypeID");

                    b.HasIndex("LoginAccountID");

                    b.ToTable("Address");
                });

            modelBuilder.Entity("DiplomovaPrace.Model.Orders.AddressType", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("nvarchar(50)");

                    b.HasKey("ID");

                    b.ToTable("AddressType");
                });

            modelBuilder.Entity("DiplomovaPrace.Model.Orders.DeliveryType", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

                    b.Property<DateTime?>("Deleted")
                        .HasColumnType("datetime2");

                    b.Property<decimal>("Fee")
                        .HasColumnType("decimal(18,2)");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("nvarchar(100)");

                    b.Property<int>("ShippingDays")
                        .HasColumnType("int");

                    b.HasKey("ID");

                    b.ToTable("DeliveryType");
                });

            modelBuilder.Entity("DiplomovaPrace.Model.Orders.Order", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

                    b.Property<DateTime>("Created")
                        .HasColumnType("datetime2");

                    b.Property<DateTime?>("Deleted")
                        .HasColumnType("datetime2");

                    b.Property<int?>("DeliveryAddressID")
                        .HasColumnType("int");

                    b.Property<int?>("DeliveryTypeID")
                        .HasColumnType("int");

                    b.Property<int?>("InvoicingAddressID")
                        .HasColumnType("int");

                    b.Property<int?>("LoginAccountID")
                        .HasColumnType("int");

                    b.Property<int>("OrderStateID")
                        .HasColumnType("int");

                    b.Property<DateTime?>("OrderedDate")
                        .HasColumnType("datetime2");

                    b.Property<int?>("PaymentStateID")
                        .HasColumnType("int");

                    b.Property<int?>("PaymentTypeID")
                        .HasColumnType("int");

                    b.Property<decimal>("TotalPrice")
                        .HasColumnType("decimal(18,2)");

                    b.HasKey("ID");

                    b.HasIndex("DeliveryAddressID");

                    b.HasIndex("DeliveryTypeID");

                    b.HasIndex("InvoicingAddressID");

                    b.HasIndex("LoginAccountID");

                    b.HasIndex("OrderStateID");

                    b.HasIndex("PaymentStateID");

                    b.HasIndex("PaymentTypeID");

                    b.ToTable("Order");
                });

            modelBuilder.Entity("DiplomovaPrace.Model.Orders.OrderItem", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

                    b.Property<int>("Amount")
                        .HasColumnType("int");

                    b.Property<int>("OrderID")
                        .HasColumnType("int");

                    b.Property<decimal>("Price")
                        .HasColumnType("decimal(18,2)");

                    b.Property<int>("ProductID")
                        .HasColumnType("int");

                    b.HasKey("ID");

                    b.HasIndex("OrderID");

                    b.HasIndex("ProductID");

                    b.ToTable("OrderItem");
                });

            modelBuilder.Entity("DiplomovaPrace.Model.Orders.OrderState", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("nvarchar(50)");

                    b.HasKey("ID");

                    b.ToTable("OrderState");
                });

            modelBuilder.Entity("DiplomovaPrace.Model.Orders.PaymentState", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("nvarchar(50)");

                    b.HasKey("ID");

                    b.ToTable("PaymentState");
                });

            modelBuilder.Entity("DiplomovaPrace.Model.Orders.PaymentType", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

                    b.Property<DateTime?>("Deleted")
                        .HasColumnType("datetime2");

                    b.Property<decimal>("Fee")
                        .HasColumnType("decimal(18,2)");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("nvarchar(100)");

                    b.HasKey("ID");

                    b.ToTable("PaymentType");
                });

            modelBuilder.Entity("DiplomovaPrace.Model.Products.Product", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

                    b.Property<int>("AvailableQuantity")
                        .HasColumnType("int");

                    b.Property<DateTime>("Created")
                        .HasColumnType("datetime2");

                    b.Property<DateTime?>("Deleted")
                        .HasColumnType("datetime2");

                    b.Property<string>("Description")
                        .HasMaxLength(5000)
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("nvarchar(200)");

                    b.Property<decimal>("Price")
                        .HasColumnType("decimal(18,2)");

                    b.Property<int?>("ProductCategoryID")
                        .HasColumnType("int");

                    b.Property<decimal?>("ReducedPrice")
                        .HasColumnType("decimal(18,2)");

                    b.HasKey("ID");

                    b.HasIndex("ProductCategoryID");

                    b.ToTable("Product");
                });

            modelBuilder.Entity("DiplomovaPrace.Model.Products.ProductCategory", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

                    b.Property<DateTime>("Created")
                        .HasColumnType("datetime2");

                    b.Property<DateTime?>("Deleted")
                        .HasColumnType("datetime2");

                    b.Property<string>("Description")
                        .HasMaxLength(300)
                        .HasColumnType("nvarchar(300)");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("nvarchar(100)");

                    b.Property<int>("ParentID")
                        .HasColumnType("int");

                    b.HasKey("ID");

                    b.HasIndex("ParentID");

                    b.ToTable("ProductCategory");

                    b.HasData(
                        new
                        {
                            ID = -1,
                            Created = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
                            Name = "Root",
                            ParentID = -1
                        });
                });

            modelBuilder.Entity("DiplomovaPrace.Model.Products.ProductImage", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

                    b.Property<DateTime>("Created")
                        .HasColumnType("datetime2");

                    b.Property<int>("ProductID")
                        .HasColumnType("int");

                    b.Property<string>("StorageName")
                        .HasMaxLength(100)
                        .HasColumnType("nvarchar(100)");

                    b.HasKey("ID");

                    b.HasIndex("ProductID");

                    b.ToTable("ProductImage");
                });

            modelBuilder.Entity("DiplomovaPrace.Model.Security.LoginAccount", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

                    b.Property<DateTime?>("Deleted")
                        .HasColumnType("datetime2");

                    b.Property<string>("Email")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("nvarchar(200)");

                    b.Property<string>("FirstName")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("nvarchar(100)");

                    b.Property<string>("LastName")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("nvarchar(100)");

                    b.Property<string>("PasswordHash")
                        .IsRequired()
                        .HasMaxLength(160)
                        .HasColumnType("nvarchar(160)");

                    b.Property<string>("PasswordSalt")
                        .IsRequired()
                        .HasMaxLength(10)
                        .HasColumnType("nvarchar(10)");

                    b.Property<int?>("RoleID")
                        .HasColumnType("int");

                    b.HasKey("ID");

                    b.HasIndex("Email")
                        .IsUnique();

                    b.HasIndex("RoleID");

                    b.ToTable("LoginAccount");
                });

            modelBuilder.Entity("DiplomovaPrace.Model.Security.Role", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("nvarchar(50)");

                    b.HasKey("ID");

                    b.HasIndex("Name")
                        .IsUnique();

                    b.ToTable("Role");
                });

            modelBuilder.Entity("Havit.Data.EntityFrameworkCore.Model.DataSeedVersion", b =>
                {
                    b.Property<string>("ProfileName")
                        .HasMaxLength(250)
                        .HasColumnType("nvarchar(250)");

                    b.Property<string>("Version")
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("ProfileName")
                        .HasName("PK_DataSeed");

                    b.ToTable("__DataSeed");
                });

            modelBuilder.Entity("DiplomovaPrace.Model.Orders.Address", b =>
                {
                    b.HasOne("DiplomovaPrace.Model.Orders.AddressType", "AddressType")
                        .WithMany()
                        .HasForeignKey("AddressTypeID")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.HasOne("DiplomovaPrace.Model.Security.LoginAccount", "LoginAccount")
                        .WithMany()
                        .HasForeignKey("LoginAccountID")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.Navigation("AddressType");

                    b.Navigation("LoginAccount");
                });

            modelBuilder.Entity("DiplomovaPrace.Model.Orders.Order", b =>
                {
                    b.HasOne("DiplomovaPrace.Model.Orders.Address", "DeliveryAddress")
                        .WithMany()
                        .HasForeignKey("DeliveryAddressID")
                        .OnDelete(DeleteBehavior.NoAction);

                    b.HasOne("DiplomovaPrace.Model.Orders.DeliveryType", "DeliveryType")
                        .WithMany()
                        .HasForeignKey("DeliveryTypeID")
                        .OnDelete(DeleteBehavior.NoAction);

                    b.HasOne("DiplomovaPrace.Model.Orders.Address", "InvoicingAddress")
                        .WithMany()
                        .HasForeignKey("InvoicingAddressID")
                        .OnDelete(DeleteBehavior.NoAction);

                    b.HasOne("DiplomovaPrace.Model.Security.LoginAccount", "LoginAccount")
                        .WithMany()
                        .HasForeignKey("LoginAccountID")
                        .OnDelete(DeleteBehavior.NoAction);

                    b.HasOne("DiplomovaPrace.Model.Orders.OrderState", "OrderState")
                        .WithMany()
                        .HasForeignKey("OrderStateID")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.HasOne("DiplomovaPrace.Model.Orders.PaymentState", "PaymentState")
                        .WithMany()
                        .HasForeignKey("PaymentStateID")
                        .OnDelete(DeleteBehavior.NoAction);

                    b.HasOne("DiplomovaPrace.Model.Orders.PaymentType", "PaymentType")
                        .WithMany()
                        .HasForeignKey("PaymentTypeID")
                        .OnDelete(DeleteBehavior.NoAction);

                    b.Navigation("DeliveryAddress");

                    b.Navigation("DeliveryType");

                    b.Navigation("InvoicingAddress");

                    b.Navigation("LoginAccount");

                    b.Navigation("OrderState");

                    b.Navigation("PaymentState");

                    b.Navigation("PaymentType");
                });

            modelBuilder.Entity("DiplomovaPrace.Model.Orders.OrderItem", b =>
                {
                    b.HasOne("DiplomovaPrace.Model.Orders.Order", "Order")
                        .WithMany("OrderItems")
                        .HasForeignKey("OrderID")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.HasOne("DiplomovaPrace.Model.Products.Product", "Product")
                        .WithMany()
                        .HasForeignKey("ProductID")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.Navigation("Order");

                    b.Navigation("Product");
                });

            modelBuilder.Entity("DiplomovaPrace.Model.Products.Product", b =>
                {
                    b.HasOne("DiplomovaPrace.Model.Products.ProductCategory", "ProductCategory")
                        .WithMany()
                        .HasForeignKey("ProductCategoryID")
                        .OnDelete(DeleteBehavior.NoAction);

                    b.Navigation("ProductCategory");
                });

            modelBuilder.Entity("DiplomovaPrace.Model.Products.ProductCategory", b =>
                {
                    b.HasOne("DiplomovaPrace.Model.Products.ProductCategory", "Parent")
                        .WithMany("Descendants")
                        .HasForeignKey("ParentID")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.Navigation("Parent");
                });

            modelBuilder.Entity("DiplomovaPrace.Model.Products.ProductImage", b =>
                {
                    b.HasOne("DiplomovaPrace.Model.Products.Product", "Product")
                        .WithMany("ProductImages")
                        .HasForeignKey("ProductID")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.Navigation("Product");
                });

            modelBuilder.Entity("DiplomovaPrace.Model.Security.LoginAccount", b =>
                {
                    b.HasOne("DiplomovaPrace.Model.Security.Role", "Role")
                        .WithMany()
                        .HasForeignKey("RoleID")
                        .OnDelete(DeleteBehavior.NoAction);

                    b.Navigation("Role");
                });

            modelBuilder.Entity("DiplomovaPrace.Model.Orders.Order", b =>
                {
                    b.Navigation("OrderItems");
                });

            modelBuilder.Entity("DiplomovaPrace.Model.Products.Product", b =>
                {
                    b.Navigation("ProductImages");
                });

            modelBuilder.Entity("DiplomovaPrace.Model.Products.ProductCategory", b =>
                {
                    b.Navigation("Descendants");
                });
#pragma warning restore 612, 618
        }
    }
}
