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

#nullable disable

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

            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);

            modelBuilder.Entity("UniversityContracts.ViewModels.EducationGroupViewModel", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("StreamId");

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

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

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

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

                    b.Property<bool>("MarkType")
                        .HasColumnType("boolean");

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("StreamId");

                    b.HasIndex("UserId");

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

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

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

                    b.Property<DateTime>("Date")
                        .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("Documents");
                });

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("UserId");

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

            modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupDocument", b =>
                {
                    b.Property<int>("EducationGroupId")
                        .HasColumnType("integer");

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

                    b.HasKey("EducationGroupId", "DocumentId");

                    b.HasIndex("DocumentId");

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

            modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupStream", b =>
                {
                    b.Property<int>("EducationGroupId")
                        .HasColumnType("integer");

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

                    b.HasKey("EducationGroupId", "StreamId");

                    b.HasIndex("StreamId");

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("UserId");

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("UserId");

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

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

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

                    b.Property<DateTime>("DateOfAddmission")
                        .HasColumnType("timestamp with time zone");

                    b.Property<DateTime>("DateOfBirth")
                        .HasColumnType("timestamp with time zone");

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("EducationStatusId");

                    b.HasIndex("UserId");

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

            modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentDocument", b =>
                {
                    b.Property<int>("StudentId")
                        .HasColumnType("integer");

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

                    b.HasKey("StudentId", "DocumentId");

                    b.HasIndex("DocumentId");

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

            modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentStream", b =>
                {
                    b.Property<int>("StudentId")
                        .HasColumnType("integer");

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

                    b.HasKey("StudentId", "StreamId");

                    b.HasIndex("StreamId");

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

            modelBuilder.Entity("UniversityDataBaseImplemet.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>("Password")
                        .IsRequired()
                        .HasColumnType("text");

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

                    b.HasKey("Id");

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

            modelBuilder.Entity("UniversityContracts.ViewModels.EducationGroupViewModel", b =>
                {
                    b.HasOne("UniversityDataBaseImplemet.Models.Stream", null)
                        .WithMany("StreamEdGroups")
                        .HasForeignKey("StreamId");
                });

            modelBuilder.Entity("UniversityDataBaseImplemet.Models.Discipline", b =>
                {
                    b.HasOne("UniversityDataBaseImplemet.Models.Stream", "Stream")
                        .WithMany()
                        .HasForeignKey("StreamId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
                        .WithMany("Disciplines")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.Navigation("Stream");

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

            modelBuilder.Entity("UniversityDataBaseImplemet.Models.Document", b =>
                {
                    b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
                        .WithMany("Documents")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

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

            modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroup", b =>
                {
                    b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
                        .WithMany("EducationGroups")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

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

            modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupDocument", b =>
                {
                    b.HasOne("UniversityDataBaseImplemet.Models.Document", "Document")
                        .WithMany("EducationGroupDocument")
                        .HasForeignKey("DocumentId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("UniversityDataBaseImplemet.Models.EducationGroup", "EducationGroup")
                        .WithMany("EducationGroupDocument")
                        .HasForeignKey("EducationGroupId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Document");

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

            modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupStream", b =>
                {
                    b.HasOne("UniversityDataBaseImplemet.Models.EducationGroup", "EducationGroup")
                        .WithMany("EducationGroupStream")
                        .HasForeignKey("EducationGroupId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("UniversityDataBaseImplemet.Models.Stream", "Stream")
                        .WithMany("EducationGroupStream")
                        .HasForeignKey("StreamId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("EducationGroup");

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

            modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationStatus", b =>
                {
                    b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
                        .WithMany("EducationStatuses")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

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

            modelBuilder.Entity("UniversityDataBaseImplemet.Models.Stream", b =>
                {
                    b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
                        .WithMany("Streams")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

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

            modelBuilder.Entity("UniversityDataBaseImplemet.Models.Student", b =>
                {
                    b.HasOne("UniversityDataBaseImplemet.Models.EducationStatus", "EducationStatus")
                        .WithMany("Students")
                        .HasForeignKey("EducationStatusId");

                    b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
                        .WithMany("Students")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.Navigation("EducationStatus");

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

            modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentDocument", b =>
                {
                    b.HasOne("UniversityDataBaseImplemet.Models.Document", "Document")
                        .WithMany("Students")
                        .HasForeignKey("DocumentId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("UniversityDataBaseImplemet.Models.Student", "Student")
                        .WithMany("DocumentStudents")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Document");

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

            modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentStream", b =>
                {
                    b.HasOne("UniversityDataBaseImplemet.Models.Stream", "Stream")
                        .WithMany("StreamStudents")
                        .HasForeignKey("StreamId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("UniversityDataBaseImplemet.Models.Student", "Student")
                        .WithMany("StudentStream")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Stream");

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

            modelBuilder.Entity("UniversityDataBaseImplemet.Models.Document", b =>
                {
                    b.Navigation("EducationGroupDocument");

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

            modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroup", b =>
                {
                    b.Navigation("EducationGroupDocument");

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

            modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationStatus", b =>
                {
                    b.Navigation("Students");
                });

            modelBuilder.Entity("UniversityDataBaseImplemet.Models.Stream", b =>
                {
                    b.Navigation("EducationGroupStream");

                    b.Navigation("StreamEdGroups");

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

            modelBuilder.Entity("UniversityDataBaseImplemet.Models.Student", b =>
                {
                    b.Navigation("DocumentStudents");

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

            modelBuilder.Entity("UniversityDataBaseImplemet.Models.User", b =>
                {
                    b.Navigation("Disciplines");

                    b.Navigation("Documents");

                    b.Navigation("EducationGroups");

                    b.Navigation("EducationStatuses");

                    b.Navigation("Streams");

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