﻿// <auto-generated />
using System;
using DKWebapp.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

namespace DKWebapp.Migrations
{
    [DbContext(typeof(ProjectContext))]
    [Migration("20210616142306_exodus")]
    partial class exodus
    {
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "2.2.6-servicing-10079");

            modelBuilder.Entity("DKWebapp.Models.Agent", b =>
                {
                    b.Property<int>("AgentId")
                        .ValueGeneratedOnAdd();

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

                    b.Property<int?>("Ancestor");

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

                    b.Property<int?>("BestStep");

                    b.Property<double?>("BestStepValue");

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

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

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

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

                    b.Property<DateTimeOffset>("StartTime");

                    b.HasKey("AgentId");

                    b.HasIndex("ProjectId");

                    b.HasIndex("ProjectRunId");

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

            modelBuilder.Entity("DKWebapp.Models.AgentControl", b =>
                {
                    b.Property<int>("AgentControlId")
                        .ValueGeneratedOnAdd();

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

                    b.Property<int?>("Signal");

                    b.HasKey("AgentControlId");

                    b.HasIndex("AgentId");

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

            modelBuilder.Entity("DKWebapp.Models.EvaluationEpisode", b =>
                {
                    b.Property<int>("EvaluationEpisodeId")
                        .ValueGeneratedOnAdd();

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

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

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

                    b.HasKey("EvaluationEpisodeId");

                    b.HasIndex("AgentId");

                    b.HasIndex("ProjectRunId");

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

            modelBuilder.Entity("DKWebapp.Models.Forecast", b =>
                {
                    b.Property<int>("ForecastId")
                        .ValueGeneratedOnAdd();

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

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

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

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

                    b.HasKey("ForecastId");

                    b.HasIndex("HydroSystemId");

                    b.HasIndex("UploadId");

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

            modelBuilder.Entity("DKWebapp.Models.HydroSystem", b =>
                {
                    b.Property<int>("HydroSystemId")
                        .ValueGeneratedOnAdd();

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

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

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

                    b.HasKey("HydroSystemId");

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

            modelBuilder.Entity("DKWebapp.Models.Project", b =>
                {
                    b.Property<int>("ProjectId")
                        .ValueGeneratedOnAdd();

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

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

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

                    b.HasKey("ProjectId");

                    b.HasIndex("HydroSystemId");

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

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

            modelBuilder.Entity("DKWebapp.Models.ProjectRun", b =>
                {
                    b.Property<int>("ProjectRunId")
                        .ValueGeneratedOnAdd();

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

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

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

                    b.Property<int?>("EvaluatedOn");

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

                    b.Property<int?>("PreviousProjectRunId");

                    b.Property<int?>("PreviousQValueProjectRunId");

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

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

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

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

                    b.HasKey("ProjectRunId");

                    b.HasIndex("EvaluatedOn");

                    b.HasIndex("ForecastId");

                    b.HasIndex("PreviousProjectRunId");

                    b.HasIndex("PreviousQValueProjectRunId");

                    b.HasIndex("ProjectId");

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

            modelBuilder.Entity("DKWebapp.Models.ProjectRunControl", b =>
                {
                    b.Property<int>("ProjectRunControlId")
                        .ValueGeneratedOnAdd();

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

                    b.Property<int?>("Signal");

                    b.HasKey("ProjectRunControlId");

                    b.HasIndex("ProjectRunId");

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

            modelBuilder.Entity("DKWebapp.Models.ProjectRunStartVolume", b =>
                {
                    b.Property<int>("ProjectRunStartVolumeId")
                        .ValueGeneratedOnAdd();

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

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

                    b.Property<double>("Value");

                    b.HasKey("ProjectRunStartVolumeId");

                    b.HasIndex("ProjectRunId");

                    b.HasIndex("ReservoirId");

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

            modelBuilder.Entity("DKWebapp.Models.ReportSeries", b =>
                {
                    b.Property<int>("ReportSeriesId")
                        .ValueGeneratedOnAdd();

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

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

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

                    b.Property<DateTimeOffset>("StartTime");

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

                    b.HasKey("ReportSeriesId");

                    b.HasIndex("EvaluationEpisodeId");

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

            modelBuilder.Entity("DKWebapp.Models.ReportValue", b =>
                {
                    b.Property<int>("ReportSeriesId");

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

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

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

                    b.Property<double>("Value");

                    b.HasKey("ReportSeriesId", "Step", "Index");

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

            modelBuilder.Entity("DKWebapp.Models.Reservoir", b =>
                {
                    b.Property<int>("ReservoirId")
                        .ValueGeneratedOnAdd();

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

                    b.Property<double>("MaxVolume");

                    b.Property<double>("MinVolume");

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

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

                    b.HasKey("ReservoirId");

                    b.HasIndex("HydroSystemId");

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

            modelBuilder.Entity("DKWebapp.Models.StepSeries", b =>
                {
                    b.Property<int>("StepSeriesId")
                        .ValueGeneratedOnAdd();

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

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

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

                    b.Property<DateTimeOffset>("StartTime");

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

                    b.HasKey("StepSeriesId");

                    b.HasIndex("AgentId");

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

            modelBuilder.Entity("DKWebapp.Models.StepValue", b =>
                {
                    b.Property<int>("StepSeriesId");

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

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

                    b.Property<double>("Value");

                    b.HasKey("StepSeriesId", "Step");

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

            modelBuilder.Entity("DKWebapp.Models.TimeDataSeries", b =>
                {
                    b.Property<int>("TimeDataSeriesId")
                        .ValueGeneratedOnAdd();

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

                    b.Property<DateTimeOffset>("EndTime");

                    b.Property<DateTimeOffset>("StartTime");

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

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

                    b.HasKey("TimeDataSeriesId");

                    b.HasIndex("UploadId");

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

            modelBuilder.Entity("DKWebapp.Models.TimeDataSeriesLink", b =>
                {
                    b.Property<int>("TimeDataSeriesLinkId")
                        .ValueGeneratedOnAdd();

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

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

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

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

                    b.HasKey("TimeDataSeriesLinkId");

                    b.HasIndex("ForecastId");

                    b.HasIndex("UploadId");

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

            modelBuilder.Entity("DKWebapp.Models.TimeDataValue", b =>
                {
                    b.Property<int>("TimeDataSeriesId");

                    b.Property<DateTimeOffset>("TimeStampOffset");

                    b.Property<double>("Value");

                    b.HasKey("TimeDataSeriesId", "TimeStampOffset");

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

            modelBuilder.Entity("DKWebapp.Models.Upload", b =>
                {
                    b.Property<int>("UploadId")
                        .ValueGeneratedOnAdd();

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

                    b.Property<DateTimeOffset>("UploadTime");

                    b.HasKey("UploadId");

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

            modelBuilder.Entity("DKWebapp.Models.Agent", b =>
                {
                    b.HasOne("DKWebapp.Models.Project", "Project")
                        .WithMany()
                        .HasForeignKey("ProjectId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("DKWebapp.Models.ProjectRun", "ProjectRun")
                        .WithMany()
                        .HasForeignKey("ProjectRunId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("DKWebapp.Models.AgentControl", b =>
                {
                    b.HasOne("DKWebapp.Models.Agent", "Agent")
                        .WithMany()
                        .HasForeignKey("AgentId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("DKWebapp.Models.EvaluationEpisode", b =>
                {
                    b.HasOne("DKWebapp.Models.Agent", "Agent")
                        .WithMany()
                        .HasForeignKey("AgentId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("DKWebapp.Models.ProjectRun", "ProjectRun")
                        .WithMany()
                        .HasForeignKey("ProjectRunId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("DKWebapp.Models.Forecast", b =>
                {
                    b.HasOne("DKWebapp.Models.HydroSystem", "HydroSystem")
                        .WithMany()
                        .HasForeignKey("HydroSystemId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("DKWebapp.Models.Upload", "Upload")
                        .WithMany()
                        .HasForeignKey("UploadId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("DKWebapp.Models.Project", b =>
                {
                    b.HasOne("DKWebapp.Models.HydroSystem", "HydroSystem")
                        .WithMany()
                        .HasForeignKey("HydroSystemId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("DKWebapp.Models.ProjectRun", b =>
                {
                    b.HasOne("DKWebapp.Models.Agent", "Agent")
                        .WithMany()
                        .HasForeignKey("EvaluatedOn");

                    b.HasOne("DKWebapp.Models.Forecast", "Forecast")
                        .WithMany()
                        .HasForeignKey("ForecastId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("DKWebapp.Models.ProjectRun", "PreviousProjectRun")
                        .WithMany()
                        .HasForeignKey("PreviousProjectRunId");

                    b.HasOne("DKWebapp.Models.ProjectRun", "PreviousQValueProjectRun")
                        .WithMany()
                        .HasForeignKey("PreviousQValueProjectRunId");

                    b.HasOne("DKWebapp.Models.Project", "Project")
                        .WithMany()
                        .HasForeignKey("ProjectId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("DKWebapp.Models.ProjectRunControl", b =>
                {
                    b.HasOne("DKWebapp.Models.ProjectRun", "ProjectRun")
                        .WithMany()
                        .HasForeignKey("ProjectRunId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("DKWebapp.Models.ProjectRunStartVolume", b =>
                {
                    b.HasOne("DKWebapp.Models.ProjectRun", "ProjectRun")
                        .WithMany()
                        .HasForeignKey("ProjectRunId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("DKWebapp.Models.Reservoir", "Reservoir")
                        .WithMany()
                        .HasForeignKey("ReservoirId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("DKWebapp.Models.ReportSeries", b =>
                {
                    b.HasOne("DKWebapp.Models.EvaluationEpisode", "EvaluationEpisode")
                        .WithMany("Series")
                        .HasForeignKey("EvaluationEpisodeId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("DKWebapp.Models.ReportValue", b =>
                {
                    b.HasOne("DKWebapp.Models.ReportSeries", "ReportSeries")
                        .WithMany("Values")
                        .HasForeignKey("ReportSeriesId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("DKWebapp.Models.Reservoir", b =>
                {
                    b.HasOne("DKWebapp.Models.HydroSystem", "HydroSystem")
                        .WithMany("Reservoirs")
                        .HasForeignKey("HydroSystemId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("DKWebapp.Models.StepSeries", b =>
                {
                    b.HasOne("DKWebapp.Models.Agent", "Agent")
                        .WithMany()
                        .HasForeignKey("AgentId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("DKWebapp.Models.StepValue", b =>
                {
                    b.HasOne("DKWebapp.Models.StepSeries", "StepSeries")
                        .WithMany("Values")
                        .HasForeignKey("StepSeriesId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("DKWebapp.Models.TimeDataSeries", b =>
                {
                    b.HasOne("DKWebapp.Models.Upload", "Upload")
                        .WithMany("Series")
                        .HasForeignKey("UploadId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("DKWebapp.Models.TimeDataSeriesLink", b =>
                {
                    b.HasOne("DKWebapp.Models.Forecast", "Forecast")
                        .WithMany("SeriesLinks")
                        .HasForeignKey("ForecastId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("DKWebapp.Models.Upload", "Upload")
                        .WithMany()
                        .HasForeignKey("UploadId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("DKWebapp.Models.TimeDataValue", b =>
                {
                    b.HasOne("DKWebapp.Models.TimeDataSeries", "TimeDataSeries")
                        .WithMany("Values")
                        .HasForeignKey("TimeDataSeriesId")
                        .OnDelete(DeleteBehavior.Cascade);
                });
#pragma warning restore 612, 618
        }
    }
}
