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

#nullable disable

namespace VeterinaryDatabaseImplement.Migrations
{
    [DbContext(typeof(VeterinaryDatabase))]
    [Migration("20240525190933_InitialCreate")]
    partial class InitialCreate
    {
        /// <inheritdoc />
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "7.0.16")
                .HasAnnotation("Relational:MaxIdentifierLength", 128);

            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);

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

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

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

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

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

                    b.HasKey("Id");

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

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

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("DoctorId");

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("DrugId");

                    b.HasIndex("MedicationId");

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("DoctorId");

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

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

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

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

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

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

                    b.HasKey("Id");

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

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

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("OwnerId");

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

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

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("DrugId");

                    b.HasIndex("OwnerId");

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("PetId");

                    b.HasIndex("PurchaseId");

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("DoctorId");

                    b.HasIndex("VisitId");

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("MedicationId");

                    b.HasIndex("ServiceId");

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

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("DoctorId");

                    b.HasIndex("OwnerId");

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("PetId");

                    b.HasIndex("VisitId");

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

            modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Drug", b =>
                {
                    b.HasOne("VeterinaryDatabaseImplement.Models.Doctor", null)
                        .WithMany("Drugs")
                        .HasForeignKey("DoctorId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("VeterinaryDatabaseImplement.Models.DrugMedication", b =>
                {
                    b.HasOne("VeterinaryDatabaseImplement.Models.Drug", "Drug")
                        .WithMany("Medications")
                        .HasForeignKey("DrugId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("VeterinaryDatabaseImplement.Models.Medication", "Medication")
                        .WithMany("DrugMedications")
                        .HasForeignKey("MedicationId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Drug");

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

            modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Medication", b =>
                {
                    b.HasOne("VeterinaryDatabaseImplement.Models.Doctor", null)
                        .WithMany("Medications")
                        .HasForeignKey("DoctorId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Pet", b =>
                {
                    b.HasOne("VeterinaryDatabaseImplement.Models.Owner", "Owner")
                        .WithMany("Pets")
                        .HasForeignKey("OwnerId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Purchase", b =>
                {
                    b.HasOne("VeterinaryDatabaseImplement.Models.Drug", "Drug")
                        .WithMany("Purchases")
                        .HasForeignKey("DrugId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("VeterinaryDatabaseImplement.Models.Owner", "Owner")
                        .WithMany("Purchases")
                        .HasForeignKey("OwnerId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Drug");

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

            modelBuilder.Entity("VeterinaryDatabaseImplement.Models.PurchasePet", b =>
                {
                    b.HasOne("VeterinaryDatabaseImplement.Models.Pet", "Pet")
                        .WithMany("Purchases")
                        .HasForeignKey("PetId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

                    b.Navigation("Pet");

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

            modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Service", b =>
                {
                    b.HasOne("VeterinaryDatabaseImplement.Models.Doctor", "Doctor")
                        .WithMany("Services")
                        .HasForeignKey("DoctorId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("VeterinaryDatabaseImplement.Models.Visit", "Visit")
                        .WithMany("Services")
                        .HasForeignKey("VisitId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Doctor");

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

            modelBuilder.Entity("VeterinaryDatabaseImplement.Models.ServiceMedication", b =>
                {
                    b.HasOne("VeterinaryDatabaseImplement.Models.Medication", "Medication")
                        .WithMany("ServiceMedications")
                        .HasForeignKey("MedicationId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("VeterinaryDatabaseImplement.Models.Service", "Service")
                        .WithMany("Medications")
                        .HasForeignKey("ServiceId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Medication");

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

            modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Visit", b =>
                {
                    b.HasOne("VeterinaryDatabaseImplement.Models.Doctor", "Doctor")
                        .WithMany("Visits")
                        .HasForeignKey("DoctorId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("VeterinaryDatabaseImplement.Models.Owner", "Owner")
                        .WithMany("Visits")
                        .HasForeignKey("OwnerId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Doctor");

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

            modelBuilder.Entity("VeterinaryDatabaseImplement.Models.VisitPet", b =>
                {
                    b.HasOne("VeterinaryDatabaseImplement.Models.Pet", "Pet")
                        .WithMany("Visits")
                        .HasForeignKey("PetId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("VeterinaryDatabaseImplement.Models.Visit", "Visit")
                        .WithMany("Pets")
                        .HasForeignKey("VisitId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Pet");

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

            modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Doctor", b =>
                {
                    b.Navigation("Drugs");

                    b.Navigation("Medications");

                    b.Navigation("Services");

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

            modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Drug", b =>
                {
                    b.Navigation("Medications");

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

            modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Medication", b =>
                {
                    b.Navigation("DrugMedications");

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

            modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Owner", b =>
                {
                    b.Navigation("Pets");

                    b.Navigation("Purchases");

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

            modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Pet", b =>
                {
                    b.Navigation("Purchases");

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

            modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Purchase", b =>
                {
                    b.Navigation("Pets");
                });

            modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Service", b =>
                {
                    b.Navigation("Medications");
                });

            modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Visit", b =>
                {
                    b.Navigation("Pets");

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