// <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 Remotely.Server.Data;

#nullable disable

namespace Remotely.Server.Migrations.SqlServer
{
    [DbContext(typeof(SqlServerDbContext))]
    [Migration("20220917171927_Branding fix")]
    partial class Brandingfix
    {
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "6.0.9")
                .HasAnnotation("Relational:MaxIdentifierLength", 128);

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

            modelBuilder.Entity("DeviceGroupRemotelyUser", b =>
                {
                    b.Property<string>("DeviceGroupsID")
                        .HasColumnType("nvarchar(450)");

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

                    b.HasKey("DeviceGroupsID", "UsersId");

                    b.HasIndex("UsersId");

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

            modelBuilder.Entity("DeviceGroupScriptSchedule", b =>
                {
                    b.Property<string>("DeviceGroupsID")
                        .HasColumnType("nvarchar(450)");

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

                    b.HasKey("DeviceGroupsID", "ScriptSchedulesId");

                    b.HasIndex("ScriptSchedulesId");

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

            modelBuilder.Entity("DeviceScriptRun", b =>
                {
                    b.Property<string>("DevicesID")
                        .HasColumnType("nvarchar(450)");

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

                    b.HasKey("DevicesID", "ScriptRunsId");

                    b.HasIndex("ScriptRunsId");

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

            modelBuilder.Entity("DeviceScriptRun1", b =>
                {
                    b.Property<string>("DevicesCompletedID")
                        .HasColumnType("nvarchar(450)");

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

                    b.HasKey("DevicesCompletedID", "ScriptRunsCompletedId");

                    b.HasIndex("ScriptRunsCompletedId");

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

            modelBuilder.Entity("DeviceScriptSchedule", b =>
                {
                    b.Property<string>("DevicesID")
                        .HasColumnType("nvarchar(450)");

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

                    b.HasKey("DevicesID", "ScriptSchedulesId");

                    b.HasIndex("ScriptSchedulesId");

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

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
                {
                    b.Property<string>("Id")
                        .HasColumnType("nvarchar(450)");

                    b.Property<string>("ConcurrencyStamp")
                        .IsConcurrencyToken()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Name")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)");

                    b.Property<string>("NormalizedName")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)");

                    b.HasKey("Id");

                    b.HasIndex("NormalizedName")
                        .IsUnique()
                        .HasDatabaseName("RoleNameIndex")
                        .HasFilter("[NormalizedName] IS NOT NULL");

                    b.ToTable("AspNetRoles", (string)null);
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("RoleId");

                    b.ToTable("AspNetRoleClaims", (string)null);
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
                {
                    b.Property<string>("Id")
                        .HasColumnType("nvarchar(450)");

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

                    b.Property<string>("ConcurrencyStamp")
                        .IsConcurrencyToken()
                        .HasColumnType("nvarchar(max)");

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

                    b.Property<string>("Email")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)");

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

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

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

                    b.Property<string>("NormalizedEmail")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)");

                    b.Property<string>("NormalizedUserName")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)");

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

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

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

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

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

                    b.Property<string>("UserName")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)");

                    b.HasKey("Id");

                    b.HasIndex("NormalizedEmail")
                        .HasDatabaseName("EmailIndex");

                    b.HasIndex("NormalizedUserName")
                        .IsUnique()
                        .HasDatabaseName("UserNameIndex")
                        .HasFilter("[NormalizedUserName] IS NOT NULL");

                    b.ToTable("RemotelyUsers", (string)null);

                    b.HasDiscriminator<string>("Discriminator").HasValue("IdentityUser");
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("UserId");

                    b.ToTable("AspNetUserClaims", (string)null);
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
                {
                    b.Property<string>("LoginProvider")
                        .HasColumnType("nvarchar(450)");

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

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

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

                    b.HasKey("LoginProvider", "ProviderKey");

                    b.HasIndex("UserId");

                    b.ToTable("AspNetUserLogins", (string)null);
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
                {
                    b.Property<string>("UserId")
                        .HasColumnType("nvarchar(450)");

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

                    b.HasKey("UserId", "RoleId");

                    b.HasIndex("RoleId");

                    b.ToTable("AspNetUserRoles", (string)null);
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
                {
                    b.Property<string>("UserId")
                        .HasColumnType("nvarchar(450)");

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

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

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

                    b.HasKey("UserId", "LoginProvider", "Name");

                    b.ToTable("AspNetUserTokens", (string)null);
                });

            modelBuilder.Entity("Remotely.Shared.Models.Alert", b =>
                {
                    b.Property<string>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("nvarchar(450)");

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

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

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

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

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

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

                    b.HasKey("ID");

                    b.HasIndex("DeviceID");

                    b.HasIndex("OrganizationID");

                    b.HasIndex("UserID");

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

            modelBuilder.Entity("Remotely.Shared.Models.ApiToken", b =>
                {
                    b.Property<string>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("nvarchar(450)");

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

                    b.Property<string>("Name")
                        .HasMaxLength(200)
                        .HasColumnType("nvarchar(200)");

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

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

                    b.HasKey("ID");

                    b.HasIndex("OrganizationID");

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

            modelBuilder.Entity("Remotely.Shared.Models.BrandingInfo", b =>
                {
                    b.Property<string>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("nvarchar(450)");

                    b.Property<byte>("ButtonForegroundBlue")
                        .HasColumnType("tinyint");

                    b.Property<byte>("ButtonForegroundGreen")
                        .HasColumnType("tinyint");

                    b.Property<byte>("ButtonForegroundRed")
                        .HasColumnType("tinyint");

                    b.Property<byte[]>("Icon")
                        .IsRequired()
                        .HasColumnType("varbinary(max)");

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

                    b.Property<string>("Product")
                        .IsRequired()
                        .HasMaxLength(25)
                        .HasColumnType("nvarchar(25)");

                    b.Property<byte>("TitleBackgroundBlue")
                        .HasColumnType("tinyint");

                    b.Property<byte>("TitleBackgroundGreen")
                        .HasColumnType("tinyint");

                    b.Property<byte>("TitleBackgroundRed")
                        .HasColumnType("tinyint");

                    b.Property<byte>("TitleForegroundBlue")
                        .HasColumnType("tinyint");

                    b.Property<byte>("TitleForegroundGreen")
                        .HasColumnType("tinyint");

                    b.Property<byte>("TitleForegroundRed")
                        .HasColumnType("tinyint");

                    b.HasKey("Id");

                    b.HasIndex("OrganizationId")
                        .IsUnique()
                        .HasFilter("[OrganizationId] IS NOT NULL");

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

            modelBuilder.Entity("Remotely.Shared.Models.Device", b =>
                {
                    b.Property<string>("ID")
                        .HasColumnType("nvarchar(450)");

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

                    b.Property<string>("Alias")
                        .HasMaxLength(100)
                        .HasColumnType("nvarchar(100)");

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

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

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

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

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

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

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

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

                    b.Property<string>("Notes")
                        .HasMaxLength(5000)
                        .HasColumnType("nvarchar(max)");

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

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

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

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

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

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

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

                    b.Property<string>("Tags")
                        .HasMaxLength(200)
                        .HasColumnType("nvarchar(200)");

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

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

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

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

                    b.HasKey("ID");

                    b.HasIndex("DeviceGroupID");

                    b.HasIndex("DeviceName");

                    b.HasIndex("OrganizationID");

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

            modelBuilder.Entity("Remotely.Shared.Models.DeviceGroup", b =>
                {
                    b.Property<string>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("nvarchar(450)");

                    b.Property<string>("Name")
                        .HasMaxLength(200)
                        .HasColumnType("nvarchar(200)");

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

                    b.HasKey("ID");

                    b.HasIndex("OrganizationID");

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

            modelBuilder.Entity("Remotely.Shared.Models.EventLog", b =>
                {
                    b.Property<string>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("nvarchar(450)");

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

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

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

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

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

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

                    b.HasKey("ID");

                    b.HasIndex("OrganizationID");

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

            modelBuilder.Entity("Remotely.Shared.Models.InviteLink", b =>
                {
                    b.Property<string>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("nvarchar(450)");

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

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

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

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

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

                    b.HasKey("ID");

                    b.HasIndex("OrganizationID");

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

            modelBuilder.Entity("Remotely.Shared.Models.Organization", b =>
                {
                    b.Property<string>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("nvarchar(450)");

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

                    b.Property<string>("OrganizationName")
                        .HasMaxLength(25)
                        .HasColumnType("nvarchar(25)");

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

                    b.HasKey("ID");

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

            modelBuilder.Entity("Remotely.Shared.Models.SavedScript", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier");

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

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

                    b.Property<string>("FolderPath")
                        .HasMaxLength(200)
                        .HasColumnType("nvarchar(200)");

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

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

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

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("nvarchar(100)");

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("CreatorId");

                    b.HasIndex("OrganizationID");

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

            modelBuilder.Entity("Remotely.Shared.Models.ScriptResult", b =>
                {
                    b.Property<string>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("nvarchar(450)");

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

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

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

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

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

                    b.Property<TimeSpan>("RunTime")
                        .HasColumnType("time");

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

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

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

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

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

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

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

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

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

                    b.HasKey("ID");

                    b.HasIndex("DeviceID");

                    b.HasIndex("OrganizationID");

                    b.HasIndex("ScheduleId");

                    b.HasIndex("ScriptRunId");

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

            modelBuilder.Entity("Remotely.Shared.Models.ScriptRun", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

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

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

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

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("OrganizationID");

                    b.HasIndex("ScriptScheduleId");

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

            modelBuilder.Entity("Remotely.Shared.Models.ScriptSchedule", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

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

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

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

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

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

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("CreatorId");

                    b.HasIndex("OrganizationID");

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

            modelBuilder.Entity("Remotely.Shared.Models.SharedFile", b =>
                {
                    b.Property<string>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("nvarchar(450)");

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

                    b.Property<byte[]>("FileContents")
                        .HasColumnType("varbinary(max)");

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

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

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

                    b.HasKey("ID");

                    b.HasIndex("OrganizationID");

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

            modelBuilder.Entity("Remotely.Shared.Models.RemotelyUser", b =>
                {
                    b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser");

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

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

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

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

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

                    b.HasIndex("OrganizationID");

                    b.HasIndex("UserName");

                    b.HasDiscriminator().HasValue("RemotelyUser");
                });

            modelBuilder.Entity("DeviceGroupRemotelyUser", b =>
                {
                    b.HasOne("Remotely.Shared.Models.DeviceGroup", null)
                        .WithMany()
                        .HasForeignKey("DeviceGroupsID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Remotely.Shared.Models.RemotelyUser", null)
                        .WithMany()
                        .HasForeignKey("UsersId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("DeviceGroupScriptSchedule", b =>
                {
                    b.HasOne("Remotely.Shared.Models.DeviceGroup", null)
                        .WithMany()
                        .HasForeignKey("DeviceGroupsID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Remotely.Shared.Models.ScriptSchedule", null)
                        .WithMany()
                        .HasForeignKey("ScriptSchedulesId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("DeviceScriptRun", b =>
                {
                    b.HasOne("Remotely.Shared.Models.Device", null)
                        .WithMany()
                        .HasForeignKey("DevicesID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Remotely.Shared.Models.ScriptRun", null)
                        .WithMany()
                        .HasForeignKey("ScriptRunsId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("DeviceScriptRun1", b =>
                {
                    b.HasOne("Remotely.Shared.Models.Device", null)
                        .WithMany()
                        .HasForeignKey("DevicesCompletedID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Remotely.Shared.Models.ScriptRun", null)
                        .WithMany()
                        .HasForeignKey("ScriptRunsCompletedId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("DeviceScriptSchedule", b =>
                {
                    b.HasOne("Remotely.Shared.Models.Device", null)
                        .WithMany()
                        .HasForeignKey("DevicesID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Remotely.Shared.Models.ScriptSchedule", null)
                        .WithMany()
                        .HasForeignKey("ScriptSchedulesId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
                {
                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
                        .WithMany()
                        .HasForeignKey("RoleId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
                {
                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
                {
                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
                {
                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
                        .WithMany()
                        .HasForeignKey("RoleId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
                {
                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Remotely.Shared.Models.Alert", b =>
                {
                    b.HasOne("Remotely.Shared.Models.Device", "Device")
                        .WithMany("Alerts")
                        .HasForeignKey("DeviceID");

                    b.HasOne("Remotely.Shared.Models.Organization", "Organization")
                        .WithMany("Alerts")
                        .HasForeignKey("OrganizationID");

                    b.HasOne("Remotely.Shared.Models.RemotelyUser", "User")
                        .WithMany("Alerts")
                        .HasForeignKey("UserID");

                    b.Navigation("Device");

                    b.Navigation("Organization");

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

            modelBuilder.Entity("Remotely.Shared.Models.ApiToken", b =>
                {
                    b.HasOne("Remotely.Shared.Models.Organization", "Organization")
                        .WithMany("ApiTokens")
                        .HasForeignKey("OrganizationID");

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

            modelBuilder.Entity("Remotely.Shared.Models.BrandingInfo", b =>
                {
                    b.HasOne("Remotely.Shared.Models.Organization", "Organization")
                        .WithOne("BrandingInfo")
                        .HasForeignKey("Remotely.Shared.Models.BrandingInfo", "OrganizationId");

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

            modelBuilder.Entity("Remotely.Shared.Models.Device", b =>
                {
                    b.HasOne("Remotely.Shared.Models.DeviceGroup", "DeviceGroup")
                        .WithMany("Devices")
                        .HasForeignKey("DeviceGroupID");

                    b.HasOne("Remotely.Shared.Models.Organization", "Organization")
                        .WithMany("Devices")
                        .HasForeignKey("OrganizationID");

                    b.Navigation("DeviceGroup");

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

            modelBuilder.Entity("Remotely.Shared.Models.DeviceGroup", b =>
                {
                    b.HasOne("Remotely.Shared.Models.Organization", "Organization")
                        .WithMany("DeviceGroups")
                        .HasForeignKey("OrganizationID");

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

            modelBuilder.Entity("Remotely.Shared.Models.EventLog", b =>
                {
                    b.HasOne("Remotely.Shared.Models.Organization", "Organization")
                        .WithMany("EventLogs")
                        .HasForeignKey("OrganizationID");

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

            modelBuilder.Entity("Remotely.Shared.Models.InviteLink", b =>
                {
                    b.HasOne("Remotely.Shared.Models.Organization", "Organization")
                        .WithMany("InviteLinks")
                        .HasForeignKey("OrganizationID");

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

            modelBuilder.Entity("Remotely.Shared.Models.SavedScript", b =>
                {
                    b.HasOne("Remotely.Shared.Models.RemotelyUser", "Creator")
                        .WithMany("SavedScripts")
                        .HasForeignKey("CreatorId");

                    b.HasOne("Remotely.Shared.Models.Organization", "Organization")
                        .WithMany("SavedScripts")
                        .HasForeignKey("OrganizationID");

                    b.Navigation("Creator");

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

            modelBuilder.Entity("Remotely.Shared.Models.ScriptResult", b =>
                {
                    b.HasOne("Remotely.Shared.Models.Device", "Device")
                        .WithMany("ScriptResults")
                        .HasForeignKey("DeviceID");

                    b.HasOne("Remotely.Shared.Models.Organization", "Organization")
                        .WithMany("ScriptResults")
                        .HasForeignKey("OrganizationID");

                    b.HasOne("Remotely.Shared.Models.ScriptSchedule", "Schedule")
                        .WithMany()
                        .HasForeignKey("ScheduleId");

                    b.HasOne("Remotely.Shared.Models.ScriptRun", null)
                        .WithMany("Results")
                        .HasForeignKey("ScriptRunId");

                    b.Navigation("Device");

                    b.Navigation("Organization");

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

            modelBuilder.Entity("Remotely.Shared.Models.ScriptRun", b =>
                {
                    b.HasOne("Remotely.Shared.Models.Organization", "Organization")
                        .WithMany("ScriptRuns")
                        .HasForeignKey("OrganizationID");

                    b.HasOne("Remotely.Shared.Models.ScriptSchedule", null)
                        .WithMany("ScriptRuns")
                        .HasForeignKey("ScriptScheduleId");

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

            modelBuilder.Entity("Remotely.Shared.Models.ScriptSchedule", b =>
                {
                    b.HasOne("Remotely.Shared.Models.RemotelyUser", "Creator")
                        .WithMany("ScriptSchedules")
                        .HasForeignKey("CreatorId");

                    b.HasOne("Remotely.Shared.Models.Organization", "Organization")
                        .WithMany("ScriptSchedules")
                        .HasForeignKey("OrganizationID");

                    b.Navigation("Creator");

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

            modelBuilder.Entity("Remotely.Shared.Models.SharedFile", b =>
                {
                    b.HasOne("Remotely.Shared.Models.Organization", "Organization")
                        .WithMany("SharedFiles")
                        .HasForeignKey("OrganizationID");

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

            modelBuilder.Entity("Remotely.Shared.Models.RemotelyUser", b =>
                {
                    b.HasOne("Remotely.Shared.Models.Organization", "Organization")
                        .WithMany("RemotelyUsers")
                        .HasForeignKey("OrganizationID");

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

            modelBuilder.Entity("Remotely.Shared.Models.Device", b =>
                {
                    b.Navigation("Alerts");

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

            modelBuilder.Entity("Remotely.Shared.Models.DeviceGroup", b =>
                {
                    b.Navigation("Devices");
                });

            modelBuilder.Entity("Remotely.Shared.Models.Organization", b =>
                {
                    b.Navigation("Alerts");

                    b.Navigation("ApiTokens");

                    b.Navigation("BrandingInfo");

                    b.Navigation("DeviceGroups");

                    b.Navigation("Devices");

                    b.Navigation("EventLogs");

                    b.Navigation("InviteLinks");

                    b.Navigation("RemotelyUsers");

                    b.Navigation("SavedScripts");

                    b.Navigation("ScriptResults");

                    b.Navigation("ScriptRuns");

                    b.Navigation("ScriptSchedules");

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

            modelBuilder.Entity("Remotely.Shared.Models.ScriptRun", b =>
                {
                    b.Navigation("Results");
                });

            modelBuilder.Entity("Remotely.Shared.Models.ScriptSchedule", b =>
                {
                    b.Navigation("ScriptRuns");
                });

            modelBuilder.Entity("Remotely.Shared.Models.RemotelyUser", b =>
                {
                    b.Navigation("Alerts");

                    b.Navigation("SavedScripts");

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