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

#nullable disable

namespace CanteenDatabaseImplement.Migrations
{
    [DbContext(typeof(CanteenDatabase))]
    [Migration("20230408175356_InitialMigr")]
    partial class InitialMigr
    {
        /// <inheritdoc />
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "7.0.4")
                .HasAnnotation("Relational:MaxIdentifierLength", 128);

            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);

            modelBuilder.Entity("CanteenDatabaseImplement.Models.Cook", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("ManagerId");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.Dish", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

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

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

                    b.Property<double>("Price")
                        .HasColumnType("float");

                    b.HasKey("Id");

                    b.HasIndex("ManagerId");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.DishProduct", b =>
                {
                    b.Property<int>("DishId")
                        .HasColumnType("int");

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

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

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

                    b.HasKey("DishId", "ProductId");

                    b.HasIndex("ProductId");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.Lunch", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

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

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

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

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

                    b.Property<double>("Sum")
                        .HasColumnType("float");

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

                    b.HasKey("Id");

                    b.HasIndex("VisitorId");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.LunchOrder", b =>
                {
                    b.Property<int>("LunchId")
                        .HasColumnType("int");

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

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

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

                    b.HasKey("LunchId", "OrderId");

                    b.HasIndex("OrderId");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.LunchProduct", b =>
                {
                    b.Property<int>("LunchId")
                        .HasColumnType("int");

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

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

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

                    b.HasKey("LunchId", "ProductId");

                    b.HasIndex("ProductId");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.Manager", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

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

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

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

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

                    b.HasKey("Id");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.Order", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

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

                    b.Property<double?>("Sum")
                        .HasColumnType("float");

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

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

                    b.HasKey("Id");

                    b.HasIndex("TablewareId");

                    b.HasIndex("VisitorId");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.OrderCook", b =>
                {
                    b.Property<int>("OrderId")
                        .HasColumnType("int");

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

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

                    b.HasKey("OrderId", "CookId");

                    b.HasIndex("CookId");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.OrderDish", b =>
                {
                    b.Property<int>("OrderId")
                        .HasColumnType("int");

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

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

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

                    b.HasKey("OrderId", "DishId");

                    b.HasIndex("DishId");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.Product", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

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

                    b.Property<double>("Price")
                        .HasColumnType("float");

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

                    b.HasKey("Id");

                    b.HasIndex("ManagerId");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.ProductCook", b =>
                {
                    b.Property<int>("ProductId")
                        .HasColumnType("int");

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

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

                    b.HasKey("ProductId", "CookId");

                    b.HasIndex("CookId");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.Tableware", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("VisitorId");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.Visitor", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

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

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

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

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

                    b.HasKey("Id");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.Cook", b =>
                {
                    b.HasOne("CanteenDatabaseImplement.Models.Manager", "Manager")
                        .WithMany("Cooks")
                        .HasForeignKey("ManagerId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.Dish", b =>
                {
                    b.HasOne("CanteenDatabaseImplement.Models.Manager", "Manager")
                        .WithMany("Dishes")
                        .HasForeignKey("ManagerId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.DishProduct", b =>
                {
                    b.HasOne("CanteenDatabaseImplement.Models.Dish", "Dish")
                        .WithMany("Products")
                        .HasForeignKey("DishId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.HasOne("CanteenDatabaseImplement.Models.Product", "Product")
                        .WithMany("Dishes")
                        .HasForeignKey("ProductId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.Navigation("Dish");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.Lunch", b =>
                {
                    b.HasOne("CanteenDatabaseImplement.Models.Visitor", "Visitor")
                        .WithMany("Lunches")
                        .HasForeignKey("VisitorId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.LunchOrder", b =>
                {
                    b.HasOne("CanteenDatabaseImplement.Models.Lunch", "Lunch")
                        .WithMany("Orders")
                        .HasForeignKey("LunchId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.HasOne("CanteenDatabaseImplement.Models.Order", "Order")
                        .WithMany("Lunches")
                        .HasForeignKey("OrderId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.Navigation("Lunch");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.LunchProduct", b =>
                {
                    b.HasOne("CanteenDatabaseImplement.Models.Lunch", "Lunch")
                        .WithMany("Products")
                        .HasForeignKey("LunchId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.HasOne("CanteenDatabaseImplement.Models.Product", "Product")
                        .WithMany("Lunches")
                        .HasForeignKey("ProductId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.Navigation("Lunch");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.Order", b =>
                {
                    b.HasOne("CanteenDatabaseImplement.Models.Tableware", "Tableware")
                        .WithMany("Orders")
                        .HasForeignKey("TablewareId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("CanteenDatabaseImplement.Models.Visitor", "Visitor")
                        .WithMany("Orders")
                        .HasForeignKey("VisitorId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.Navigation("Tableware");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.OrderCook", b =>
                {
                    b.HasOne("CanteenDatabaseImplement.Models.Cook", "Cook")
                        .WithMany("Orders")
                        .HasForeignKey("CookId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.HasOne("CanteenDatabaseImplement.Models.Order", "Order")
                        .WithMany("Cooks")
                        .HasForeignKey("OrderId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.Navigation("Cook");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.OrderDish", b =>
                {
                    b.HasOne("CanteenDatabaseImplement.Models.Dish", "Dish")
                        .WithMany("Orders")
                        .HasForeignKey("DishId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.HasOne("CanteenDatabaseImplement.Models.Order", "Order")
                        .WithMany("Dishes")
                        .HasForeignKey("OrderId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.Navigation("Dish");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.Product", b =>
                {
                    b.HasOne("CanteenDatabaseImplement.Models.Manager", "Manager")
                        .WithMany("Products")
                        .HasForeignKey("ManagerId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.ProductCook", b =>
                {
                    b.HasOne("CanteenDatabaseImplement.Models.Cook", "Cook")
                        .WithMany("Products")
                        .HasForeignKey("CookId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.HasOne("CanteenDatabaseImplement.Models.Product", "Product")
                        .WithMany("Cooks")
                        .HasForeignKey("ProductId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.Navigation("Cook");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.Tableware", b =>
                {
                    b.HasOne("CanteenDatabaseImplement.Models.Visitor", "Visitor")
                        .WithMany("Tablewares")
                        .HasForeignKey("VisitorId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.Cook", b =>
                {
                    b.Navigation("Orders");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.Dish", b =>
                {
                    b.Navigation("Orders");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.Lunch", b =>
                {
                    b.Navigation("Orders");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.Manager", b =>
                {
                    b.Navigation("Cooks");

                    b.Navigation("Dishes");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.Order", b =>
                {
                    b.Navigation("Cooks");

                    b.Navigation("Dishes");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.Product", b =>
                {
                    b.Navigation("Cooks");

                    b.Navigation("Dishes");

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

            modelBuilder.Entity("CanteenDatabaseImplement.Models.Tableware", b =>
                {
                    b.Navigation("Orders");
                });

            modelBuilder.Entity("CanteenDatabaseImplement.Models.Visitor", b =>
                {
                    b.Navigation("Lunches");

                    b.Navigation("Orders");

                    b.Navigation("Tablewares");
                });
#pragma warning restore 612, 618
        }
    }
}
