// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Ombi.Store.Context.MySql;

namespace Ombi.Store.Migrations.ExternalMySql
{
    [DbContext(typeof(ExternalMySqlContext))]
    [Migration("20191103213915_Inital")]
    partial class Inital
    {
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
                .HasAnnotation("Relational:MaxIdentifierLength", 64);

            modelBuilder.Entity("Ombi.Store.Entities.CouchPotatoCache", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd();

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

                    b.HasKey("Id");

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

            modelBuilder.Entity("Ombi.Store.Entities.EmbyContent", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd();

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

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

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

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

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

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

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

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

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

                    b.HasKey("Id");

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

            modelBuilder.Entity("Ombi.Store.Entities.EmbyEpisode", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd();

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

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

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

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

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("ParentId");

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

            modelBuilder.Entity("Ombi.Store.Entities.LidarrAlbumCache", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd();

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

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

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

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

                    b.Property<decimal>("PercentOfTracks");

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

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

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

                    b.HasKey("Id");

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

            modelBuilder.Entity("Ombi.Store.Entities.LidarrArtistCache", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd();

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

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

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

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

                    b.HasKey("Id");

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

            modelBuilder.Entity("Ombi.Store.Entities.PlexEpisode", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd();

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("GrandparentKey");

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

            modelBuilder.Entity("Ombi.Store.Entities.PlexSeasonsContent", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd();

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("PlexServerContentId");

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

            modelBuilder.Entity("Ombi.Store.Entities.PlexServerContent", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd();

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

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

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

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

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

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

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

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

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

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

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

                    b.HasKey("Id");

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

            modelBuilder.Entity("Ombi.Store.Entities.RadarrCache", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd();

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

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

                    b.HasKey("Id");

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

            modelBuilder.Entity("Ombi.Store.Entities.SickRageCache", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd();

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

                    b.HasKey("Id");

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

            modelBuilder.Entity("Ombi.Store.Entities.SickRageEpisodeCache", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd();

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

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

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

                    b.HasKey("Id");

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

            modelBuilder.Entity("Ombi.Store.Entities.SonarrCache", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd();

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

                    b.HasKey("Id");

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

            modelBuilder.Entity("Ombi.Store.Entities.SonarrEpisodeCache", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd();

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

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

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

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

                    b.HasKey("Id");

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

            modelBuilder.Entity("Ombi.Store.Entities.EmbyEpisode", b =>
                {
                    b.HasOne("Ombi.Store.Entities.EmbyContent", "Series")
                        .WithMany("Episodes")
                        .HasForeignKey("ParentId")
                        .HasPrincipalKey("EmbyId");
                });

            modelBuilder.Entity("Ombi.Store.Entities.PlexEpisode", b =>
                {
                    b.HasOne("Ombi.Store.Entities.PlexServerContent", "Series")
                        .WithMany("Episodes")
                        .HasForeignKey("GrandparentKey")
                        .HasPrincipalKey("Key")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("Ombi.Store.Entities.PlexSeasonsContent", b =>
                {
                    b.HasOne("Ombi.Store.Entities.PlexServerContent")
                        .WithMany("Seasons")
                        .HasForeignKey("PlexServerContentId");
                });
#pragma warning restore 612, 618
        }
    }
}
