// <auto-generated />
using System;
using FurnitureAssemblyDatabaseImplement;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

#nullable disable

namespace FurnitureAssemblyDatabaseImplement.Migrations
{
    [DbContext(typeof(FurnitureAssemblyDatabase))]
    partial class FurnitureAssemblyDatabaseModelSnapshot : ModelSnapshot
    {
        protected override void BuildModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "7.0.5")
                .HasAnnotation("Relational:MaxIdentifierLength", 63);

            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Furniture", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

                    b.Property<double>("Cost")
                        .HasColumnType("double precision");

                    b.Property<DateTime>("DateCreate")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<int>("UserId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("UserId");

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

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.FurnitureMaterial", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

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

                    b.Property<int>("FurnitureId")
                        .HasColumnType("integer");

                    b.Property<int>("MaterialId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("FurnitureId");

                    b.HasIndex("MaterialId");

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

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.FurnitureModule", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

                    b.Property<double>("Cost")
                        .HasColumnType("double precision");

                    b.Property<DateTime>("DateCreate")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<int>("UserId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("UserId");

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

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.FurnitureModuleFurniture", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

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

                    b.Property<int>("FurnitureId")
                        .HasColumnType("integer");

                    b.Property<int>("FurnitureModuleId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("FurnitureId");

                    b.HasIndex("FurnitureModuleId");

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

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Material", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

                    b.Property<double>("Cost")
                        .HasColumnType("double precision");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<int>("ScopeId")
                        .HasColumnType("integer");

                    b.Property<int>("UserId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("ScopeId");

                    b.HasIndex("UserId");

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

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

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

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

                    b.Property<int>("OrderInfoId")
                        .HasColumnType("integer");

                    b.Property<int>("SetId")
                        .HasColumnType("integer");

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

                    b.HasKey("Id");

                    b.HasIndex("OrderInfoId");

                    b.HasIndex("SetId");

                    b.HasIndex("UserId");

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

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.OrderInfo", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

                    b.Property<string>("CustomerName")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<DateTime>("DateCreate")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("PaymentType")
                        .HasColumnType("integer");

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

                    b.Property<int>("UserId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("UserId");

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

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Role", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasColumnType("text");

                    b.HasKey("Id");

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

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Scope", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasColumnType("text");

                    b.HasKey("Id");

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

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Set", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

                    b.Property<double>("Cost")
                        .HasColumnType("double precision");

                    b.Property<DateTime>("DateCreate")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<int>("UserId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("UserId");

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

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.SetFurnitureModule", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

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

                    b.Property<int>("FurnitureModuleId")
                        .HasColumnType("integer");

                    b.Property<int>("SetId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("FurnitureModuleId");

                    b.HasIndex("SetId");

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

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.User", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

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

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasColumnType("text");

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

                    b.Property<int>("RoleId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("RoleId");

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

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Furniture", b =>
                {
                    b.HasOne("FurnitureAssemblyDatabaseImplement.Models.User", "User")
                        .WithMany("Furnitures")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.FurnitureMaterial", b =>
                {
                    b.HasOne("FurnitureAssemblyDatabaseImplement.Models.Furniture", "Furniture")
                        .WithMany("Materials")
                        .HasForeignKey("FurnitureId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("FurnitureAssemblyDatabaseImplement.Models.Material", "Material")
                        .WithMany("FurnitureMaterials")
                        .HasForeignKey("MaterialId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Furniture");

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

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.FurnitureModule", b =>
                {
                    b.HasOne("FurnitureAssemblyDatabaseImplement.Models.User", "User")
                        .WithMany("FurnitureModules")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.FurnitureModuleFurniture", b =>
                {
                    b.HasOne("FurnitureAssemblyDatabaseImplement.Models.Furniture", "Furniture")
                        .WithMany()
                        .HasForeignKey("FurnitureId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("FurnitureAssemblyDatabaseImplement.Models.FurnitureModule", "FurnitureModule")
                        .WithMany("Furnitures")
                        .HasForeignKey("FurnitureModuleId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Furniture");

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

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Material", b =>
                {
                    b.HasOne("FurnitureAssemblyDatabaseImplement.Models.Scope", "Scope")
                        .WithMany("Materials")
                        .HasForeignKey("ScopeId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("FurnitureAssemblyDatabaseImplement.Models.User", "User")
                        .WithMany("Materials")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Scope");

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

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Order", b =>
                {
                    b.HasOne("FurnitureAssemblyDatabaseImplement.Models.OrderInfo", "OrderInfo")
                        .WithMany()
                        .HasForeignKey("OrderInfoId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("FurnitureAssemblyDatabaseImplement.Models.Set", "Set")
                        .WithMany("Orders")
                        .HasForeignKey("SetId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("FurnitureAssemblyDatabaseImplement.Models.User", null)
                        .WithMany("Orders")
                        .HasForeignKey("UserId");

                    b.Navigation("OrderInfo");

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

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.OrderInfo", b =>
                {
                    b.HasOne("FurnitureAssemblyDatabaseImplement.Models.User", "User")
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Set", b =>
                {
                    b.HasOne("FurnitureAssemblyDatabaseImplement.Models.User", "User")
                        .WithMany("Sets")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.SetFurnitureModule", b =>
                {
                    b.HasOne("FurnitureAssemblyDatabaseImplement.Models.FurnitureModule", "FurnitureModule")
                        .WithMany("Sets")
                        .HasForeignKey("FurnitureModuleId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("FurnitureAssemblyDatabaseImplement.Models.Set", "Set")
                        .WithMany("FurnitureModules")
                        .HasForeignKey("SetId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("FurnitureModule");

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

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.User", b =>
                {
                    b.HasOne("FurnitureAssemblyDatabaseImplement.Models.Role", "Role")
                        .WithMany("Users")
                        .HasForeignKey("RoleId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Furniture", b =>
                {
                    b.Navigation("Materials");
                });

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.FurnitureModule", b =>
                {
                    b.Navigation("Furnitures");

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

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Material", b =>
                {
                    b.Navigation("FurnitureMaterials");
                });

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Role", b =>
                {
                    b.Navigation("Users");
                });

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Scope", b =>
                {
                    b.Navigation("Materials");
                });

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Set", b =>
                {
                    b.Navigation("FurnitureModules");

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

            modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.User", b =>
                {
                    b.Navigation("FurnitureModules");

                    b.Navigation("Furnitures");

                    b.Navigation("Materials");

                    b.Navigation("Orders");

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