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

#nullable disable

namespace BankDatabaseImplement.Migrations
{
    [DbContext(typeof(BankDatabase))]
    [Migration("20230407133918_InitialCreate")]
    partial class InitialCreate
    {
        /// <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("BankDatabaseImplement.Models.BankOperator", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

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

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

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

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

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

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

                    b.HasKey("Id");

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

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

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

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

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

                    b.Property<float>("Percent")
                        .HasColumnType("real");

                    b.HasKey("Id");

                    b.HasIndex("BankOperatorId");

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("CreditProgramId");

                    b.HasIndex("CurrencyId");

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("BankOperatorId");

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("CurrencyId");

                    b.HasIndex("PaymentId");

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

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

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

                    b.Property<float>("Amount")
                        .HasColumnType("real");

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("BankOperatorId");

                    b.HasIndex("CurrencyId");

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

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("CreditProgramId");

                    b.HasIndex("OperatorId");

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("DealId");

                    b.HasIndex("PaymentId");

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

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

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

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

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

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

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

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

                    b.HasKey("Id");

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("OperatorId");

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

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

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

                    b.Property<float>("Amount")
                        .HasColumnType("real");

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("OperatorId");

                    b.HasIndex("PaymentId");

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

            modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgram", b =>
                {
                    b.HasOne("BankDatabaseImplement.Models.BankOperator", "BankOperator")
                        .WithMany()
                        .HasForeignKey("BankOperatorId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgramCurrency", b =>
                {
                    b.HasOne("BankDatabaseImplement.Models.CreditProgram", "CreditProgram")
                        .WithMany("Currencies")
                        .HasForeignKey("CreditProgramId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("BankDatabaseImplement.Models.Currency", "Currency")
                        .WithMany()
                        .HasForeignKey("CurrencyId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("CreditProgram");

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

            modelBuilder.Entity("BankDatabaseImplement.Models.Currency", b =>
                {
                    b.HasOne("BankDatabaseImplement.Models.BankOperator", "BankOperator")
                        .WithMany()
                        .HasForeignKey("BankOperatorId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("BankDatabaseImplement.Models.CurrencyPayment", b =>
                {
                    b.HasOne("BankDatabaseImplement.Models.Currency", "Currency")
                        .WithMany()
                        .HasForeignKey("CurrencyId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("BankDatabaseImplement.Models.Payment", "Payment")
                        .WithMany("Currencies")
                        .HasForeignKey("PaymentId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Currency");

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

            modelBuilder.Entity("BankDatabaseImplement.Models.CurrencyPurchase", b =>
                {
                    b.HasOne("BankDatabaseImplement.Models.BankOperator", "BankOperator")
                        .WithMany()
                        .HasForeignKey("BankOperatorId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("BankDatabaseImplement.Models.Currency", "Currency")
                        .WithMany()
                        .HasForeignKey("CurrencyId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("BankOperator");

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

            modelBuilder.Entity("BankDatabaseImplement.Models.Deal", b =>
                {
                    b.HasOne("BankDatabaseImplement.Models.CreditProgram", "CreditProgram")
                        .WithMany()
                        .HasForeignKey("CreditProgramId");

                    b.HasOne("BankDatabaseImplement.Models.Operator", "Operator")
                        .WithMany()
                        .HasForeignKey("OperatorId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("CreditProgram");

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

            modelBuilder.Entity("BankDatabaseImplement.Models.DealPayment", b =>
                {
                    b.HasOne("BankDatabaseImplement.Models.Deal", "Deal")
                        .WithMany("DealPayments")
                        .HasForeignKey("DealId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("BankDatabaseImplement.Models.Payment", "Payment")
                        .WithMany("Deals")
                        .HasForeignKey("PaymentId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Deal");

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

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

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

            modelBuilder.Entity("BankDatabaseImplement.Models.Transfer", b =>
                {
                    b.HasOne("BankDatabaseImplement.Models.Operator", "Operator")
                        .WithMany()
                        .HasForeignKey("OperatorId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("BankDatabaseImplement.Models.Payment", "Payment")
                        .WithMany()
                        .HasForeignKey("PaymentId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Operator");

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

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

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

            modelBuilder.Entity("BankDatabaseImplement.Models.Payment", b =>
                {
                    b.Navigation("Currencies");

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