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

#nullable disable

namespace BankDatabaseImplement.Migrations
{
    [DbContext(typeof(BankDB))]
    partial class BankDBModelSnapshot : 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("BankDatabaseImplement.Models.Client", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

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

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

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

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

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

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

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

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

                    b.HasKey("Id");

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("EmployeeId");

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("CostId");

                    b.HasIndex("PurchaseId");

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

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

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

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

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

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

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

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

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

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

                    b.HasKey("Id");

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

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("EmployeeId");

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("OperationId");

                    b.HasIndex("PurchaseId");

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

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

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

                    b.Property<DateOnly>("Date")
                        .HasColumnType("date");

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

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

                    b.HasKey("Id");

                    b.HasIndex("OperationByPurchaseId");

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

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

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

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

                    b.Property<DateOnly>("DatePurchase")
                        .HasColumnType("date");

                    b.HasKey("Id");

                    b.HasIndex("ClientId");

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

            modelBuilder.Entity("BankDatabaseImplement.Models.Cost", b =>
                {
                    b.HasOne("BankDatabaseImplement.Models.Employee", "Employee")
                        .WithMany("Costs")
                        .HasForeignKey("EmployeeId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("BankDatabaseImplement.Models.CostByPurchase", b =>
                {
                    b.HasOne("BankDatabaseImplement.Models.Cost", "Cost")
                        .WithMany("Purchases")
                        .HasForeignKey("CostId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("BankDatabaseImplement.Models.Purchase", "Purchase")
                        .WithMany("Costs")
                        .HasForeignKey("PurchaseId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Cost");

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

            modelBuilder.Entity("BankDatabaseImplement.Models.Operation", b =>
                {
                    b.HasOne("BankDatabaseImplement.Models.Employee", "Employee")
                        .WithMany("Operations")
                        .HasForeignKey("EmployeeId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("BankDatabaseImplement.Models.OperationByPurchase", b =>
                {
                    b.HasOne("BankDatabaseImplement.Models.Operation", "Operation")
                        .WithMany("Purchases")
                        .HasForeignKey("OperationId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("BankDatabaseImplement.Models.Purchase", "Purchase")
                        .WithMany("Operations")
                        .HasForeignKey("PurchaseId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Operation");

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

            modelBuilder.Entity("BankDatabaseImplement.Models.Payment", b =>
                {
                    b.HasOne("BankDatabaseImplement.Models.OperationByPurchase", "OperationByPurchase")
                        .WithMany("Payments")
                        .HasForeignKey("OperationByPurchaseId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("BankDatabaseImplement.Models.Purchase", b =>
                {
                    b.HasOne("BankDatabaseImplement.Models.Client", "Client")
                        .WithMany("Purchases")
                        .HasForeignKey("ClientId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("BankDatabaseImplement.Models.Client", b =>
                {
                    b.Navigation("Purchases");
                });

            modelBuilder.Entity("BankDatabaseImplement.Models.Cost", b =>
                {
                    b.Navigation("Purchases");
                });

            modelBuilder.Entity("BankDatabaseImplement.Models.Employee", b =>
                {
                    b.Navigation("Costs");

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

            modelBuilder.Entity("BankDatabaseImplement.Models.Operation", b =>
                {
                    b.Navigation("Purchases");
                });

            modelBuilder.Entity("BankDatabaseImplement.Models.OperationByPurchase", b =>
                {
                    b.Navigation("Payments");
                });

            modelBuilder.Entity("BankDatabaseImplement.Models.Purchase", b =>
                {
                    b.Navigation("Costs");

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