// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using System;
using TicTacToe.Data;

namespace TicTacToe.Migrations
{
    [DbContext(typeof(GameDbContext))]
    [Migration("20171122080450_AddTwoFactorCode")]
    partial class AddTwoFactorCode
    {
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "2.0.1-rtm-125")
                .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

            modelBuilder.Entity("TicTacToe.Models.GameInvitationModel", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<DateTime>("ConfirmationDate");

                    b.Property<string>("EmailTo");

                    b.Property<string>("InvitedBy");

                    b.Property<Guid>("InvitedByUserId");

                    b.Property<bool>("IsConfirmed");

                    b.HasKey("Id");

                    b.HasIndex("InvitedByUserId");

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

            modelBuilder.Entity("TicTacToe.Models.GameSessionModel", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<Guid>("ActiveUserId");

                    b.Property<bool>("TurnFinished");

                    b.Property<int>("TurnNumber");

                    b.Property<Guid?>("User2Id");

                    b.Property<Guid>("UserId1");

                    b.Property<Guid>("UserId2");

                    b.Property<Guid>("WinnerId");

                    b.HasKey("Id");

                    b.HasIndex("User2Id");

                    b.HasIndex("UserId1");

                    b.HasIndex("WinnerId");

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

            modelBuilder.Entity("TicTacToe.Models.RoleModel", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<string>("ConcurrencyStamp");

                    b.Property<string>("Name");

                    b.Property<string>("NormalizedName");

                    b.HasKey("Id");

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

            modelBuilder.Entity("TicTacToe.Models.TurnModel", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<string>("Email");

                    b.Property<Guid?>("GameSessionModelId");

                    b.Property<string>("IconNumber");

                    b.Property<Guid>("UserId");

                    b.Property<int>("X");

                    b.Property<int>("Y");

                    b.HasKey("Id");

                    b.HasIndex("GameSessionModelId");

                    b.HasIndex("UserId");

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

            modelBuilder.Entity("TicTacToe.Models.TwoFactorCodeModel", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<string>("TokenCode");

                    b.Property<string>("TokenProvider");

                    b.Property<Guid>("UserId");

                    b.HasKey("Id");

                    b.HasIndex("UserId");

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

            modelBuilder.Entity("TicTacToe.Models.UserModel", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<int>("AccessFailedCount");

                    b.Property<string>("ConcurrencyStamp");

                    b.Property<string>("Email");

                    b.Property<DateTime?>("EmailConfirmationDate");

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

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

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

                    b.Property<bool>("LockoutEnabled");

                    b.Property<DateTimeOffset?>("LockoutEnd");

                    b.Property<string>("NormalizedEmail");

                    b.Property<string>("NormalizedUserName");

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

                    b.Property<string>("PasswordHash");

                    b.Property<string>("PhoneNumber");

                    b.Property<bool>("PhoneNumberConfirmed");

                    b.Property<int>("Score");

                    b.Property<string>("SecurityStamp");

                    b.Property<bool>("TwoFactorEnabled");

                    b.Property<string>("UserName");

                    b.HasKey("Id");

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

            modelBuilder.Entity("TicTacToe.Models.GameInvitationModel", b =>
                {
                    b.HasOne("TicTacToe.Models.UserModel", "InvitedByUser")
                        .WithMany()
                        .HasForeignKey("InvitedByUserId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("TicTacToe.Models.GameSessionModel", b =>
                {
                    b.HasOne("TicTacToe.Models.UserModel", "User2")
                        .WithMany()
                        .HasForeignKey("User2Id")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("TicTacToe.Models.UserModel", "User1")
                        .WithMany()
                        .HasForeignKey("UserId1")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("TicTacToe.Models.UserModel", "Winner")
                        .WithMany()
                        .HasForeignKey("WinnerId")
                        .OnDelete(DeleteBehavior.Restrict);
                });

            modelBuilder.Entity("TicTacToe.Models.TurnModel", b =>
                {
                    b.HasOne("TicTacToe.Models.GameSessionModel")
                        .WithMany("Turns")
                        .HasForeignKey("GameSessionModelId");

                    b.HasOne("TicTacToe.Models.UserModel", "User")
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("TicTacToe.Models.TwoFactorCodeModel", b =>
                {
                    b.HasOne("TicTacToe.Models.UserModel", "User")
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade);
                });
#pragma warning restore 612, 618
        }
    }
}
