// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Sledgemapper.Api.Infrastructure.Data;

namespace Sledgemapper.Api.Migrations
{
    [DbContext(typeof(SledgemapperDbContext))]
    [Migration("20210219223251_Adding authentication to our Api")]
    partial class AddingauthenticationtoourApi
    {
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "5.0.3");

            modelBuilder.Entity("CampaignUser", b =>
                {
                    b.Property<int>("CampaignsCampaignId")
                        .HasColumnType("INTEGER");

                    b.Property<int>("InvitedUsersId")
                        .HasColumnType("INTEGER");

                    b.HasKey("CampaignsCampaignId", "InvitedUsersId");

                    b.HasIndex("InvitedUsersId");

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

            modelBuilder.Entity("Sledgemapper.Api.Core.Entities.Campaign", b =>
                {
                    b.Property<int>("CampaignId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

                    b.Property<string>("CampaignName")
                        .HasColumnType("TEXT");

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

                    b.HasKey("CampaignId");

                    b.HasIndex("OwnerId");

                    b.HasIndex("CampaignName", "OwnerId")
                        .IsUnique();

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

            modelBuilder.Entity("Sledgemapper.Api.Core.Entities.Map", b =>
                {
                    b.Property<int>("MapId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

                    b.Property<int>("CampaignId")
                        .HasColumnType("INTEGER");

                    b.Property<string>("MapName")
                        .IsRequired()
                        .HasColumnType("TEXT");

                    b.HasKey("MapId");

                    b.HasIndex("CampaignId");

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

            modelBuilder.Entity("Sledgemapper.Api.Models.MapLog", b =>
                {
                    b.Property<int>("MapLogId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

                    b.Property<string>("Object")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("TEXT");

                    b.Property<string>("Operation")
                        .IsRequired()
                        .HasMaxLength(1)
                        .HasColumnType("TEXT");

                    b.Property<int>("SessionId")
                        .HasColumnType("INTEGER");

                    b.Property<double>("Timestamp")
                        .HasColumnType("REAL");

                    b.Property<string>("Type")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("TEXT");

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

                    b.HasKey("MapLogId");

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

            modelBuilder.Entity("Sledgemapper.Api.Models.Session", b =>
                {
                    b.Property<int>("SessionId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

                    b.Property<int>("OwnerUserId")
                        .HasColumnType("INTEGER");

                    b.Property<string>("SessionName")
                        .IsRequired()
                        .HasColumnType("TEXT");

                    b.HasKey("SessionId");

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

            modelBuilder.Entity("Sledgemapper.Api.Models.SessionUser", b =>
                {
                    b.Property<int>("SessionUserId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

                    b.Property<int>("SessionId")
                        .HasColumnType("INTEGER");

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

                    b.HasKey("SessionUserId");

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

            modelBuilder.Entity("Sledgemapper.Api.Models.Snapshot", b =>
                {
                    b.Property<int>("SnapshotId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

                    b.Property<string>("Object")
                        .IsRequired()
                        .HasColumnType("TEXT");

                    b.Property<int>("SessionId")
                        .HasColumnType("INTEGER");

                    b.Property<double>("Timestamp")
                        .HasColumnType("REAL");

                    b.HasKey("SnapshotId");

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

            modelBuilder.Entity("Sledgemapper.Api.Models.UserConnection", b =>
                {
                    b.Property<int>("UserConnectionId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

                    b.Property<string>("ConnectionId")
                        .IsRequired()
                        .HasColumnType("TEXT");

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

                    b.HasKey("UserConnectionId");

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

            modelBuilder.Entity("Sledgemapper.Entities.User", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

                    b.Property<string>("FirstName")
                        .HasColumnType("TEXT");

                    b.Property<string>("Initials")
                        .HasColumnType("TEXT");

                    b.Property<string>("LastName")
                        .HasColumnType("TEXT");

                    b.Property<byte[]>("PasswordHash")
                        .HasColumnType("BLOB");

                    b.Property<byte[]>("PasswordSalt")
                        .HasColumnType("BLOB");

                    b.Property<string>("Username")
                        .HasColumnType("TEXT");

                    b.HasKey("Id");

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

            modelBuilder.Entity("CampaignUser", b =>
                {
                    b.HasOne("Sledgemapper.Api.Core.Entities.Campaign", null)
                        .WithMany()
                        .HasForeignKey("CampaignsCampaignId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Sledgemapper.Entities.User", null)
                        .WithMany()
                        .HasForeignKey("InvitedUsersId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Sledgemapper.Api.Core.Entities.Campaign", b =>
                {
                    b.HasOne("Sledgemapper.Entities.User", "Owner")
                        .WithMany()
                        .HasForeignKey("OwnerId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("Sledgemapper.Api.Core.Entities.Map", b =>
                {
                    b.HasOne("Sledgemapper.Api.Core.Entities.Campaign", null)
                        .WithMany("Maps")
                        .HasForeignKey("CampaignId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Sledgemapper.Api.Core.Entities.Campaign", b =>
                {
                    b.Navigation("Maps");
                });
#pragma warning restore 612, 618
        }
    }
}
