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

#nullable disable

namespace CarCenterDataBaseImplement.Migrations
{
    [DbContext(typeof(CarCenterDataBase))]
    [Migration("20240526165712_WithoutCount")]
    partial class WithoutCount
    {
        /// <inheritdoc />
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "7.0.5")
                .HasAnnotation("Relational:MaxIdentifierLength", 128);

            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);

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

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

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

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

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

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

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

                    b.HasKey("Id");

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("AdministratorId");

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("ManagerId");

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("EmployeeId");

                    b.HasIndex("SaleId");

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

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("AdministratorId");

                    b.HasIndex("PreSaleWorkId");

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("CarId");

                    b.HasIndex("EquipmentId");

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

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("AdministratorId");

                    b.HasIndex("EmployeeId");

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("CarId");

                    b.HasIndex("InspectionId");

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

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

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

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

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

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

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

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

                    b.HasKey("Id");

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("ManagerId");

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("PreSaleWorkId");

                    b.HasIndex("SaleId");

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("ManagerId");

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

            modelBuilder.Entity("CarCenterDataBaseImplement.Models.Car", b =>
                {
                    b.HasOne("CarCenterDataBaseImplement.Models.Administrator", "Administrator")
                        .WithMany("Cars")
                        .HasForeignKey("AdministratorId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("CarCenterDataBaseImplement.Models.Employee", b =>
                {
                    b.HasOne("CarCenterDataBaseImplement.Models.Manager", "Manager")
                        .WithMany("Employees")
                        .HasForeignKey("ManagerId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("CarCenterDataBaseImplement.Models.EmployeeSale", b =>
                {
                    b.HasOne("CarCenterDataBaseImplement.Models.Employee", "Employee")
                        .WithMany("Sales")
                        .HasForeignKey("EmployeeId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("CarCenterDataBaseImplement.Models.Sale", "Sale")
                        .WithMany("EmployeeSales")
                        .HasForeignKey("SaleId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Employee");

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

            modelBuilder.Entity("CarCenterDataBaseImplement.Models.Equipment", b =>
                {
                    b.HasOne("CarCenterDataBaseImplement.Models.Administrator", "Administrator")
                        .WithMany("Equipments")
                        .HasForeignKey("AdministratorId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("CarCenterDataBaseImplement.Models.PreSaleWork", "PreSaleWork")
                        .WithMany("Equipments")
                        .HasForeignKey("PreSaleWorkId");

                    b.Navigation("Administrator");

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

            modelBuilder.Entity("CarCenterDataBaseImplement.Models.EquipmentCar", b =>
                {
                    b.HasOne("CarCenterDataBaseImplement.Models.Car", "Car")
                        .WithMany("EquipmentCars")
                        .HasForeignKey("CarId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("CarCenterDataBaseImplement.Models.Equipment", "Equipment")
                        .WithMany("Cars")
                        .HasForeignKey("EquipmentId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Car");

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

            modelBuilder.Entity("CarCenterDataBaseImplement.Models.Inspection", b =>
                {
                    b.HasOne("CarCenterDataBaseImplement.Models.Administrator", "Administrator")
                        .WithMany("Inspections")
                        .HasForeignKey("AdministratorId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("CarCenterDataBaseImplement.Models.Employee", "Employee")
                        .WithMany("Inspections")
                        .HasForeignKey("EmployeeId");

                    b.Navigation("Administrator");

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

            modelBuilder.Entity("CarCenterDataBaseImplement.Models.InspectionCar", b =>
                {
                    b.HasOne("CarCenterDataBaseImplement.Models.Car", "Car")
                        .WithMany("InspectionCar")
                        .HasForeignKey("CarId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("CarCenterDataBaseImplement.Models.Inspection", "Inspection")
                        .WithMany("Cars")
                        .HasForeignKey("InspectionId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Car");

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

            modelBuilder.Entity("CarCenterDataBaseImplement.Models.PreSaleWork", b =>
                {
                    b.HasOne("CarCenterDataBaseImplement.Models.Manager", "Manager")
                        .WithMany("PreSaleWorks")
                        .HasForeignKey("ManagerId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("CarCenterDataBaseImplement.Models.PreSaleWorkSale", b =>
                {
                    b.HasOne("CarCenterDataBaseImplement.Models.PreSaleWork", "PreSaleWork")
                        .WithMany("Sales")
                        .HasForeignKey("PreSaleWorkId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("CarCenterDataBaseImplement.Models.Sale", "Sale")
                        .WithMany("PreSaleWorkSale")
                        .HasForeignKey("SaleId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("PreSaleWork");

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

            modelBuilder.Entity("CarCenterDataBaseImplement.Models.Sale", b =>
                {
                    b.HasOne("CarCenterDataBaseImplement.Models.Manager", "Manager")
                        .WithMany("Sales")
                        .HasForeignKey("ManagerId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("CarCenterDataBaseImplement.Models.Administrator", b =>
                {
                    b.Navigation("Cars");

                    b.Navigation("Equipments");

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

            modelBuilder.Entity("CarCenterDataBaseImplement.Models.Car", b =>
                {
                    b.Navigation("EquipmentCars");

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

            modelBuilder.Entity("CarCenterDataBaseImplement.Models.Employee", b =>
                {
                    b.Navigation("Inspections");

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

            modelBuilder.Entity("CarCenterDataBaseImplement.Models.Equipment", b =>
                {
                    b.Navigation("Cars");
                });

            modelBuilder.Entity("CarCenterDataBaseImplement.Models.Inspection", b =>
                {
                    b.Navigation("Cars");
                });

            modelBuilder.Entity("CarCenterDataBaseImplement.Models.Manager", b =>
                {
                    b.Navigation("Employees");

                    b.Navigation("PreSaleWorks");

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

            modelBuilder.Entity("CarCenterDataBaseImplement.Models.PreSaleWork", b =>
                {
                    b.Navigation("Equipments");

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

            modelBuilder.Entity("CarCenterDataBaseImplement.Models.Sale", b =>
                {
                    b.Navigation("EmployeeSales");

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