// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using Remotely.Server.Data;

namespace Remotely.Server.Migrations.PostgreSql
{
    [DbContext(typeof(PostgreSqlDbContext))]
    [Migration("20210417155843_Add Alert Details")]
    partial class AddAlertDetails
    {
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("Relational:MaxIdentifierLength", 63)
                .HasAnnotation("ProductVersion", "5.0.5")
                .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

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

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

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

                    b.HasIndex("UsersId");

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

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

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

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

                    b.HasIndex("ScriptSchedulesId");

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

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

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

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

                    b.HasIndex("ScriptRunsId");

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

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

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

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

                    b.HasIndex("ScriptRunsCompletedId");

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

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

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

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

                    b.HasIndex("ScriptSchedulesId");

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("NormalizedName")
                        .IsUnique()
                        .HasDatabaseName("RoleNameIndex");

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

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("RoleId");

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

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

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

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

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

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

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

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

                    b.Property<DateTimeOffset?>("LockoutEnd")
                        .HasColumnType("timestamp with time zone");

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

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

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

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

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

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

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

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

                    b.HasKey("Id");

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

                    b.HasIndex("NormalizedUserName")
                        .IsUnique()
                        .HasDatabaseName("UserNameIndex");

                    b.ToTable("RemotelyUsers");

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

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("UserId");

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

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
                {
                    b.Property<string>("LoginProvider")
                        .HasMaxLength(128)
                        .HasColumnType("character varying(128)");

                    b.Property<string>("ProviderKey")
                        .HasMaxLength(128)
                        .HasColumnType("character varying(128)");

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

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

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

                    b.HasIndex("UserId");

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

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

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

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

                    b.HasIndex("RoleId");

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

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

                    b.Property<string>("LoginProvider")
                        .HasMaxLength(128)
                        .HasColumnType("character varying(128)");

                    b.Property<string>("Name")
                        .HasMaxLength(128)
                        .HasColumnType("character varying(128)");

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

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

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

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

                    b.Property<DateTimeOffset>("CreatedOn")
                        .HasColumnType("timestamp with time zone");

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

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

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

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

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

                    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("text");

                    b.Property<DateTimeOffset?>("LastUsed")
                        .HasColumnType("timestamp with time zone");

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

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

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

                    b.HasKey("ID");

                    b.HasIndex("OrganizationID");

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

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

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

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

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

                    b.Property<byte[]>("Icon")
                        .HasColumnType("bytea");

                    b.Property<string>("Product")
                        .HasMaxLength(25)
                        .HasColumnType("character varying(25)");

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

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

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

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

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

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

                    b.HasKey("Id");

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

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

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

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

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

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

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

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

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

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

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

                    b.Property<DateTimeOffset>("LastOnline")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Notes")
                        .HasMaxLength(5000)
                        .HasColumnType("character varying(5000)");

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

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

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

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

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

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

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

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

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

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

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

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

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

                    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("text");

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

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

                    b.HasKey("ID");

                    b.HasIndex("OrganizationID");

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

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

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

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

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

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

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

                    b.Property<DateTimeOffset>("TimeStamp")
                        .HasColumnType("timestamp with time zone");

                    b.HasKey("ID");

                    b.HasIndex("OrganizationID");

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

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

                    b.Property<DateTimeOffset>("DateSent")
                        .HasColumnType("timestamp with time zone");

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

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

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

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

                    b.HasKey("ID");

                    b.HasIndex("OrganizationID");

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

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

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

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

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

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

                    b.HasKey("ID");

                    b.HasIndex("BrandingInfoId");

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

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

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

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

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

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

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

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

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

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

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

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

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

                    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("text");

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    b.Property<DateTimeOffset>("TimeStamp")
                        .HasColumnType("timestamp with time zone");

                    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("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

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

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

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

                    b.Property<DateTimeOffset>("RunAt")
                        .HasColumnType("timestamp with time zone");

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

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

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

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

                    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("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<DateTimeOffset>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

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

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

                    b.Property<DateTimeOffset?>("LastRun")
                        .HasColumnType("timestamp with time zone");

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

                    b.Property<DateTimeOffset>("NextRun")
                        .HasColumnType("timestamp with time zone");

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

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

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

                    b.Property<DateTimeOffset>("StartAt")
                        .HasColumnType("timestamp with time zone");

                    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("text");

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

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

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

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

                    b.Property<DateTimeOffset>("Timestamp")
                        .HasColumnType("timestamp with time zone");

                    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("boolean");

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

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

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

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

                    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.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.Organization", b =>
                {
                    b.HasOne("Remotely.Shared.Models.BrandingInfo", "BrandingInfo")
                        .WithMany()
                        .HasForeignKey("BrandingInfoId");

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

            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("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
        }
    }
}
