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

#nullable disable

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

            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);

            modelBuilder.Entity("FurnitureAssembly_WorkerDatabaseImplement.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("FurnitureAssembly_WorkerDatabaseImplement.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("FurnitureAssembly_WorkerDatabaseImplement.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("FurnitureAssembly_WorkerDatabaseImplement.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("FurnitureAssembly_WorkerDatabaseImplement.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("FurnitureAssembly_WorkerDatabaseImplement.Models.Order", 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<int>("SetId")
                        .HasColumnType("integer");

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

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

                    b.HasKey("Id");

                    b.HasIndex("SetId");

                    b.HasIndex("UserId");

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

            modelBuilder.Entity("FurnitureAssembly_WorkerDatabaseImplement.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("FurnitureAssembly_WorkerDatabaseImplement.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("FurnitureAssembly_WorkerDatabaseImplement.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("FurnitureAssembly_WorkerDatabaseImplement.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("FurnitureAssembly_WorkerDatabaseImplement.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("FurnitureAssembly_WorkerDatabaseImplement.Models.Furniture", b =>
                {
                    b.HasOne("FurnitureAssembly_WorkerDatabaseImplement.Models.User", "User")
                        .WithMany("Furnitures")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

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

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

                    b.Navigation("Furniture");

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

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

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

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

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

                    b.Navigation("Furniture");

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

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

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

                    b.Navigation("Scope");

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

            modelBuilder.Entity("FurnitureAssembly_WorkerDatabaseImplement.Models.Order", b =>
                {
                    b.HasOne("FurnitureAssembly_WorkerDatabaseImplement.Models.Set", "Set")
                        .WithMany("Orders")
                        .HasForeignKey("SetId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

                    b.Navigation("Set");

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

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

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

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

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

                    b.Navigation("FurnitureModule");

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

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

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

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

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

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

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

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

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

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

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

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

                    b.Navigation("Furnitures");

                    b.Navigation("Materials");

                    b.Navigation("Orders");

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