// <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 e_suite.Database.SqlServer;

#nullable disable

namespace e_suite.Database.SqlServer.Migrations
{
    [DbContext(typeof(SqlEsuiteDatabaseDbContext))]
    [Migration("20220823111110_Initial Database")]
    partial class InitialDatabase
    {
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "6.0.8")
                .HasAnnotation("Relational:MaxIdentifierLength", 128);

            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);

            modelBuilder.Entity("e_suite.Database.Core.Tables.Audit.AuditDetail", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("bigint");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 1L, 1);

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

                    b.Property<DateTimeOffset>("DateTime")
                        .HasColumnType("datetimeoffset");

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

                    b.Property<string>("Type")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("nvarchar(50)");

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

                    b.Property<long>("UserId")
                        .HasColumnType("bigint");

                    b.HasKey("Id");

                    b.ToTable("AuditDetails", "Audit");
                });

            modelBuilder.Entity("e_suite.Database.Core.Tables.Audit.AuditDrillHierarchy", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("bigint");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 1L, 1);

                    b.Property<long>("ChildAuditDrillDownEntityId")
                        .HasColumnType("bigint");

                    b.Property<long>("ParentAuditDrillDownEntityId")
                        .HasColumnType("bigint");

                    b.HasKey("Id");

                    b.HasIndex("ChildAuditDrillDownEntityId");

                    b.HasIndex("ParentAuditDrillDownEntityId");

                    b.ToTable("AuditDrillHierarchies", "Audit");
                });

            modelBuilder.Entity("e_suite.Database.Core.Tables.Audit.AuditEntry", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("bigint");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 1L, 1);

                    b.Property<long>("AuditLogId")
                        .HasColumnType("bigint");

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

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

                    b.Property<bool>("IsPrimary")
                        .HasColumnType("bit");

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

                    b.HasKey("Id");

                    b.HasIndex("AuditLogId");

                    b.ToTable("AuditEntries", "Audit");
                });

            modelBuilder.Entity("e_suite.Database.Core.Tables.Sentinel.FailedAccessAttempt", b =>
                {
                    b.Property<string>("IPAddress")
                        .HasMaxLength(50)
                        .HasColumnType("nvarchar(50)");

                    b.Property<DateTimeOffset>("AttemptedTime")
                        .HasColumnType("datetimeoffset");

                    b.HasKey("IPAddress", "AttemptedTime");

                    b.ToTable("FailedAccessAttempts", "Sentinel");
                });

            modelBuilder.Entity("e_suite.Database.Core.Tables.UserManager.EmailUserAction", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("bigint");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 1L, 1);

                    b.Property<DateTimeOffset>("Created")
                        .HasColumnType("datetimeoffset");

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

                    b.Property<DateTimeOffset>("Expires")
                        .HasColumnType("datetimeoffset");

                    b.Property<Guid>("Token")
                        .HasColumnType("uniqueidentifier");

                    b.Property<long>("UserId")
                        .HasColumnType("bigint");

                    b.HasKey("Id");

                    b.HasAlternateKey("Token", "EmailActionType");

                    b.HasIndex("UserId");

                    b.ToTable("EmailUserActions", "UserManager");
                });

            modelBuilder.Entity("e_suite.Database.Core.Tables.UserManager.User", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("bigint");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 1L, 1);

                    b.Property<bool>("Active")
                        .HasColumnType("bit");

                    b.Property<DateTimeOffset>("Created")
                        .HasColumnType("datetimeoffset");

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

                    b.Property<bool>("EmailConfirmed")
                        .HasColumnType("bit");

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

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

                    b.Property<DateTimeOffset>("LastUpdated")
                        .HasColumnType("datetimeoffset");

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

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

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

                    b.Property<bool>("UsingTwoFactorAuthentication")
                        .HasColumnType("bit");

                    b.HasKey("Id");

                    b.HasIndex("Email")
                        .IsUnique();

                    b.ToTable("Users", "UserManager");

                    b.HasData(
                        new
                        {
                            Id = 1L,
                            Active = true,
                            Created = new DateTimeOffset(new DateTime(2022, 6, 9, 12, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
                            Email = "testuser1@sun-strategy.com",
                            EmailConfirmed = true,
                            FirstName = "Test1",
                            LastName = "User",
                            LastUpdated = new DateTimeOffset(new DateTime(2022, 6, 9, 12, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
                            MiddleNames = "",
                            Password = "AgAAAAIAACcQAAAAAAAAABDGmF9Hre4l8k9lkZAxBRJk0zNHD2b6xfKz4C7h6UjuirkoyoP2fVR6d9b7riT03UnL5yAgFh2pSSVQDx+nQ5PBjZRB9UG4u5FrY8W7ouA/+w==",
                            TwoFactorAuthenticationKey = "4EHHG42OWCN3L72TSRYSHTV6MRJXVOY3",
                            UsingTwoFactorAuthentication = false
                        });
                });

            modelBuilder.Entity("e_suite.Database.Core.Tables.Audit.AuditDrillHierarchy", b =>
                {
                    b.HasOne("e_suite.Database.Core.Tables.Audit.AuditEntry", "ChildAuditDrillDownEntity")
                        .WithMany()
                        .HasForeignKey("ChildAuditDrillDownEntityId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.HasOne("e_suite.Database.Core.Tables.Audit.AuditEntry", "ParentAuditDrillDownEntity")
                        .WithMany()
                        .HasForeignKey("ParentAuditDrillDownEntityId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.Navigation("ChildAuditDrillDownEntity");

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

            modelBuilder.Entity("e_suite.Database.Core.Tables.Audit.AuditEntry", b =>
                {
                    b.HasOne("e_suite.Database.Core.Tables.Audit.AuditDetail", "AuditLog")
                        .WithMany()
                        .HasForeignKey("AuditLogId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("e_suite.Database.Core.Tables.UserManager.EmailUserAction", b =>
                {
                    b.HasOne("e_suite.Database.Core.Tables.UserManager.User", "User")
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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