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

namespace ErsatzTV.Infrastructure.Sqlite.Migrations
{
    [DbContext(typeof(TvContext))]
    [Migration("20210302224925_Add_FFmpegProfileHardwareAcceleration")]
    partial class Add_FFmpegProfileHardwareAcceleration
    {
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "5.0.3");

            modelBuilder.Entity("ErsatzTV.Core.Domain.Artwork", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

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

                    b.Property<DateTime>("DateAdded")
                        .HasColumnType("TEXT");

                    b.Property<DateTime>("DateUpdated")
                        .HasColumnType("TEXT");

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("ChannelId");

                    b.HasIndex("EpisodeMetadataId");

                    b.HasIndex("MovieMetadataId");

                    b.HasIndex("SeasonMetadataId");

                    b.HasIndex("ShowMetadataId");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.Channel", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

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

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

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

                    b.Property<Guid>("UniqueId")
                        .HasColumnType("TEXT");

                    b.HasKey("Id");

                    b.HasIndex("FFmpegProfileId");

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

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.Collection", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

                    b.HasKey("Id");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.CollectionItem", b =>
                {
                    b.Property<int>("CollectionId")
                        .HasColumnType("INTEGER");

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

                    b.HasKey("CollectionId", "MediaItemId");

                    b.HasIndex("MediaItemId");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.ConfigElement", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

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

                    b.HasKey("Id");

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

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.EpisodeMetadata", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

                    b.Property<DateTime>("DateAdded")
                        .HasColumnType("TEXT");

                    b.Property<DateTime>("DateUpdated")
                        .HasColumnType("TEXT");

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

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

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

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

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

                    b.Property<DateTime?>("ReleaseDate")
                        .HasColumnType("TEXT");

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("EpisodeId");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.FFmpegProfile", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

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

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

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

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

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

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

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

                    b.Property<bool>("NormalizeAudio")
                        .HasColumnType("INTEGER");

                    b.Property<bool>("NormalizeAudioCodec")
                        .HasColumnType("INTEGER");

                    b.Property<bool>("NormalizeResolution")
                        .HasColumnType("INTEGER");

                    b.Property<bool>("NormalizeVideoCodec")
                        .HasColumnType("INTEGER");

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

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

                    b.Property<bool>("Transcode")
                        .HasColumnType("INTEGER");

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("ResolutionId");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.Library", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

                    b.Property<DateTime?>("LastScan")
                        .HasColumnType("TEXT");

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("MediaSourceId");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.LibraryPath", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

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

                    b.HasKey("Id");

                    b.HasIndex("LibraryId");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.MediaFile", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

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

                    b.HasKey("Id");

                    b.HasIndex("MediaVersionId");

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

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.MediaItem", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

                    b.HasKey("Id");

                    b.HasIndex("LibraryPathId");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.MediaSource", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

                    b.HasKey("Id");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.MediaVersion", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

                    b.Property<DateTime>("DateAdded")
                        .HasColumnType("TEXT");

                    b.Property<DateTime>("DateUpdated")
                        .HasColumnType("TEXT");

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

                    b.Property<TimeSpan>("Duration")
                        .HasColumnType("TEXT");

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

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

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("EpisodeId");

                    b.HasIndex("MovieId");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.MovieMetadata", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

                    b.Property<DateTime>("DateAdded")
                        .HasColumnType("TEXT");

                    b.Property<DateTime>("DateUpdated")
                        .HasColumnType("TEXT");

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

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

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

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

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

                    b.Property<DateTime?>("ReleaseDate")
                        .HasColumnType("TEXT");

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("MovieId");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.Playout", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("ChannelId");

                    b.HasIndex("ProgramScheduleId");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.PlayoutItem", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

                    b.Property<DateTime>("Finish")
                        .HasColumnType("TEXT");

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

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

                    b.Property<DateTime>("Start")
                        .HasColumnType("TEXT");

                    b.HasKey("Id");

                    b.HasIndex("MediaItemId");

                    b.HasIndex("PlayoutId");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.PlayoutProgramScheduleAnchor", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("CollectionId");

                    b.HasIndex("MediaItemId");

                    b.HasIndex("PlayoutId");

                    b.HasIndex("ProgramScheduleId");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.PlexConnection", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

                    b.Property<bool>("IsActive")
                        .HasColumnType("INTEGER");

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

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

                    b.HasKey("Id");

                    b.HasIndex("PlexMediaSourceId");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.PlexPathReplacement", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("PlexMediaSourceId");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.ProgramSchedule", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

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

                    b.HasKey("Id");

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

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.ProgramScheduleItem", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

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

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

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

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

                    b.Property<TimeSpan?>("StartTime")
                        .HasColumnType("TEXT");

                    b.HasKey("Id");

                    b.HasIndex("CollectionId");

                    b.HasIndex("MediaItemId");

                    b.HasIndex("ProgramScheduleId");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.Resolution", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

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

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

                    b.HasKey("Id");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.SeasonMetadata", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

                    b.Property<DateTime>("DateAdded")
                        .HasColumnType("TEXT");

                    b.Property<DateTime>("DateUpdated")
                        .HasColumnType("TEXT");

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

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

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

                    b.Property<DateTime?>("ReleaseDate")
                        .HasColumnType("TEXT");

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("SeasonId");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.ShowMetadata", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

                    b.Property<DateTime>("DateAdded")
                        .HasColumnType("TEXT");

                    b.Property<DateTime>("DateUpdated")
                        .HasColumnType("TEXT");

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

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

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

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

                    b.Property<DateTime?>("ReleaseDate")
                        .HasColumnType("TEXT");

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("ShowId");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.LocalLibrary", b =>
                {
                    b.HasBaseType("ErsatzTV.Core.Domain.Library");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.PlexLibrary", b =>
                {
                    b.HasBaseType("ErsatzTV.Core.Domain.Library");

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

                    b.Property<bool>("ShouldSyncItems")
                        .HasColumnType("INTEGER");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.PlexMediaFile", b =>
                {
                    b.HasBaseType("ErsatzTV.Core.Domain.MediaFile");

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

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

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.Episode", b =>
                {
                    b.HasBaseType("ErsatzTV.Core.Domain.MediaItem");

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

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

                    b.HasIndex("SeasonId");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.Movie", b =>
                {
                    b.HasBaseType("ErsatzTV.Core.Domain.MediaItem");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.Season", b =>
                {
                    b.HasBaseType("ErsatzTV.Core.Domain.MediaItem");

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

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

                    b.HasIndex("ShowId");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.Show", b =>
                {
                    b.HasBaseType("ErsatzTV.Core.Domain.MediaItem");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.LocalMediaSource", b =>
                {
                    b.HasBaseType("ErsatzTV.Core.Domain.MediaSource");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.PlexMediaSource", b =>
                {
                    b.HasBaseType("ErsatzTV.Core.Domain.MediaSource");

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

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

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

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.ProgramScheduleItemDuration", b =>
                {
                    b.HasBaseType("ErsatzTV.Core.Domain.ProgramScheduleItem");

                    b.Property<bool>("OfflineTail")
                        .HasColumnType("INTEGER");

                    b.Property<TimeSpan>("PlayoutDuration")
                        .HasColumnType("TEXT");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.ProgramScheduleItemFlood", b =>
                {
                    b.HasBaseType("ErsatzTV.Core.Domain.ProgramScheduleItem");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.ProgramScheduleItemMultiple", b =>
                {
                    b.HasBaseType("ErsatzTV.Core.Domain.ProgramScheduleItem");

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

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.ProgramScheduleItemOne", b =>
                {
                    b.HasBaseType("ErsatzTV.Core.Domain.ProgramScheduleItem");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.PlexMovie", b =>
                {
                    b.HasBaseType("ErsatzTV.Core.Domain.Movie");

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

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.Artwork", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.Channel", null)
                        .WithMany("Artwork")
                        .HasForeignKey("ChannelId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("ErsatzTV.Core.Domain.EpisodeMetadata", null)
                        .WithMany("Artwork")
                        .HasForeignKey("EpisodeMetadataId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("ErsatzTV.Core.Domain.MovieMetadata", null)
                        .WithMany("Artwork")
                        .HasForeignKey("MovieMetadataId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("ErsatzTV.Core.Domain.SeasonMetadata", null)
                        .WithMany("Artwork")
                        .HasForeignKey("SeasonMetadataId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("ErsatzTV.Core.Domain.ShowMetadata", null)
                        .WithMany("Artwork")
                        .HasForeignKey("ShowMetadataId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("ErsatzTV.Core.Domain.Channel", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.FFmpegProfile", "FFmpegProfile")
                        .WithMany()
                        .HasForeignKey("FFmpegProfileId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.CollectionItem", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.Collection", "Collection")
                        .WithMany("CollectionItems")
                        .HasForeignKey("CollectionId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ErsatzTV.Core.Domain.MediaItem", "MediaItem")
                        .WithMany("CollectionItems")
                        .HasForeignKey("MediaItemId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Collection");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.EpisodeMetadata", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.Episode", "Episode")
                        .WithMany("EpisodeMetadata")
                        .HasForeignKey("EpisodeId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.FFmpegProfile", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.Resolution", "Resolution")
                        .WithMany()
                        .HasForeignKey("ResolutionId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.Library", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.MediaSource", "MediaSource")
                        .WithMany("Libraries")
                        .HasForeignKey("MediaSourceId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.LibraryPath", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.Library", "Library")
                        .WithMany("Paths")
                        .HasForeignKey("LibraryId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.MediaFile", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.MediaVersion", "MediaVersion")
                        .WithMany("MediaFiles")
                        .HasForeignKey("MediaVersionId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.MediaItem", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.LibraryPath", "LibraryPath")
                        .WithMany("MediaItems")
                        .HasForeignKey("LibraryPathId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.MediaVersion", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.Episode", null)
                        .WithMany("MediaVersions")
                        .HasForeignKey("EpisodeId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("ErsatzTV.Core.Domain.Movie", null)
                        .WithMany("MediaVersions")
                        .HasForeignKey("MovieId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("ErsatzTV.Core.Domain.MovieMetadata", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.Movie", "Movie")
                        .WithMany("MovieMetadata")
                        .HasForeignKey("MovieId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.Playout", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.Channel", "Channel")
                        .WithMany("Playouts")
                        .HasForeignKey("ChannelId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ErsatzTV.Core.Domain.ProgramSchedule", "ProgramSchedule")
                        .WithMany("Playouts")
                        .HasForeignKey("ProgramScheduleId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.OwnsOne("ErsatzTV.Core.Domain.PlayoutAnchor", "Anchor", b1 =>
                        {
                            b1.Property<int>("PlayoutId")
                                .HasColumnType("INTEGER");

                            b1.Property<int>("NextScheduleItemId")
                                .HasColumnType("INTEGER");

                            b1.Property<DateTime>("NextStart")
                                .HasColumnType("TEXT");

                            b1.HasKey("PlayoutId");

                            b1.HasIndex("NextScheduleItemId");

                            b1.ToTable("Playout");

                            b1.HasOne("ErsatzTV.Core.Domain.ProgramScheduleItem", "NextScheduleItem")
                                .WithMany()
                                .HasForeignKey("NextScheduleItemId")
                                .OnDelete(DeleteBehavior.Cascade)
                                .IsRequired();

                            b1.WithOwner()
                                .HasForeignKey("PlayoutId");

                            b1.Navigation("NextScheduleItem");
                        });

                    b.Navigation("Anchor");

                    b.Navigation("Channel");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.PlayoutItem", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.MediaItem", "MediaItem")
                        .WithMany()
                        .HasForeignKey("MediaItemId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ErsatzTV.Core.Domain.Playout", "Playout")
                        .WithMany("Items")
                        .HasForeignKey("PlayoutId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("MediaItem");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.PlayoutProgramScheduleAnchor", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.Collection", "Collection")
                        .WithMany()
                        .HasForeignKey("CollectionId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("ErsatzTV.Core.Domain.MediaItem", "MediaItem")
                        .WithMany()
                        .HasForeignKey("MediaItemId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("ErsatzTV.Core.Domain.Playout", "Playout")
                        .WithMany("ProgramScheduleAnchors")
                        .HasForeignKey("PlayoutId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ErsatzTV.Core.Domain.ProgramSchedule", "ProgramSchedule")
                        .WithMany()
                        .HasForeignKey("ProgramScheduleId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.OwnsOne("ErsatzTV.Core.Domain.CollectionEnumeratorState", "EnumeratorState", b1 =>
                        {
                            b1.Property<int>("PlayoutProgramScheduleAnchorId")
                                .HasColumnType("INTEGER");

                            b1.Property<int>("Index")
                                .HasColumnType("INTEGER");

                            b1.Property<int>("Seed")
                                .HasColumnType("INTEGER");

                            b1.HasKey("PlayoutProgramScheduleAnchorId");

                            b1.ToTable("PlayoutProgramScheduleAnchor");

                            b1.WithOwner()
                                .HasForeignKey("PlayoutProgramScheduleAnchorId");
                        });

                    b.Navigation("Collection");

                    b.Navigation("EnumeratorState");

                    b.Navigation("MediaItem");

                    b.Navigation("Playout");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.PlexConnection", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.PlexMediaSource", "PlexMediaSource")
                        .WithMany("Connections")
                        .HasForeignKey("PlexMediaSourceId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.PlexPathReplacement", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.PlexMediaSource", "PlexMediaSource")
                        .WithMany("PathReplacements")
                        .HasForeignKey("PlexMediaSourceId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.ProgramScheduleItem", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.Collection", "Collection")
                        .WithMany()
                        .HasForeignKey("CollectionId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("ErsatzTV.Core.Domain.MediaItem", "MediaItem")
                        .WithMany()
                        .HasForeignKey("MediaItemId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("ErsatzTV.Core.Domain.ProgramSchedule", "ProgramSchedule")
                        .WithMany("Items")
                        .HasForeignKey("ProgramScheduleId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Collection");

                    b.Navigation("MediaItem");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.SeasonMetadata", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.Season", "Season")
                        .WithMany("SeasonMetadata")
                        .HasForeignKey("SeasonId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.ShowMetadata", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.Show", "Show")
                        .WithMany("ShowMetadata")
                        .HasForeignKey("ShowId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.LocalLibrary", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.Library", null)
                        .WithOne()
                        .HasForeignKey("ErsatzTV.Core.Domain.LocalLibrary", "Id")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("ErsatzTV.Core.Domain.PlexLibrary", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.Library", null)
                        .WithOne()
                        .HasForeignKey("ErsatzTV.Core.Domain.PlexLibrary", "Id")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("ErsatzTV.Core.Domain.PlexMediaFile", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.MediaFile", null)
                        .WithOne()
                        .HasForeignKey("ErsatzTV.Core.Domain.PlexMediaFile", "Id")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("ErsatzTV.Core.Domain.Episode", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.MediaItem", null)
                        .WithOne()
                        .HasForeignKey("ErsatzTV.Core.Domain.Episode", "Id")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ErsatzTV.Core.Domain.Season", "Season")
                        .WithMany("Episodes")
                        .HasForeignKey("SeasonId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.Movie", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.MediaItem", null)
                        .WithOne()
                        .HasForeignKey("ErsatzTV.Core.Domain.Movie", "Id")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("ErsatzTV.Core.Domain.Season", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.MediaItem", null)
                        .WithOne()
                        .HasForeignKey("ErsatzTV.Core.Domain.Season", "Id")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ErsatzTV.Core.Domain.Show", "Show")
                        .WithMany("Seasons")
                        .HasForeignKey("ShowId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.Show", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.MediaItem", null)
                        .WithOne()
                        .HasForeignKey("ErsatzTV.Core.Domain.Show", "Id")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("ErsatzTV.Core.Domain.LocalMediaSource", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.MediaSource", null)
                        .WithOne()
                        .HasForeignKey("ErsatzTV.Core.Domain.LocalMediaSource", "Id")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("ErsatzTV.Core.Domain.PlexMediaSource", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.MediaSource", null)
                        .WithOne()
                        .HasForeignKey("ErsatzTV.Core.Domain.PlexMediaSource", "Id")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("ErsatzTV.Core.Domain.ProgramScheduleItemDuration", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.ProgramScheduleItem", null)
                        .WithOne()
                        .HasForeignKey("ErsatzTV.Core.Domain.ProgramScheduleItemDuration", "Id")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("ErsatzTV.Core.Domain.ProgramScheduleItemFlood", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.ProgramScheduleItem", null)
                        .WithOne()
                        .HasForeignKey("ErsatzTV.Core.Domain.ProgramScheduleItemFlood", "Id")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("ErsatzTV.Core.Domain.ProgramScheduleItemMultiple", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.ProgramScheduleItem", null)
                        .WithOne()
                        .HasForeignKey("ErsatzTV.Core.Domain.ProgramScheduleItemMultiple", "Id")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("ErsatzTV.Core.Domain.ProgramScheduleItemOne", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.ProgramScheduleItem", null)
                        .WithOne()
                        .HasForeignKey("ErsatzTV.Core.Domain.ProgramScheduleItemOne", "Id")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("ErsatzTV.Core.Domain.PlexMovie", b =>
                {
                    b.HasOne("ErsatzTV.Core.Domain.Movie", null)
                        .WithOne()
                        .HasForeignKey("ErsatzTV.Core.Domain.PlexMovie", "Id")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("ErsatzTV.Core.Domain.Channel", b =>
                {
                    b.Navigation("Artwork");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.Collection", b =>
                {
                    b.Navigation("CollectionItems");
                });

            modelBuilder.Entity("ErsatzTV.Core.Domain.EpisodeMetadata", b =>
                {
                    b.Navigation("Artwork");
                });

            modelBuilder.Entity("ErsatzTV.Core.Domain.Library", b =>
                {
                    b.Navigation("Paths");
                });

            modelBuilder.Entity("ErsatzTV.Core.Domain.LibraryPath", b =>
                {
                    b.Navigation("MediaItems");
                });

            modelBuilder.Entity("ErsatzTV.Core.Domain.MediaItem", b =>
                {
                    b.Navigation("CollectionItems");
                });

            modelBuilder.Entity("ErsatzTV.Core.Domain.MediaSource", b =>
                {
                    b.Navigation("Libraries");
                });

            modelBuilder.Entity("ErsatzTV.Core.Domain.MediaVersion", b =>
                {
                    b.Navigation("MediaFiles");
                });

            modelBuilder.Entity("ErsatzTV.Core.Domain.MovieMetadata", b =>
                {
                    b.Navigation("Artwork");
                });

            modelBuilder.Entity("ErsatzTV.Core.Domain.Playout", b =>
                {
                    b.Navigation("Items");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.ProgramSchedule", b =>
                {
                    b.Navigation("Items");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.SeasonMetadata", b =>
                {
                    b.Navigation("Artwork");
                });

            modelBuilder.Entity("ErsatzTV.Core.Domain.ShowMetadata", b =>
                {
                    b.Navigation("Artwork");
                });

            modelBuilder.Entity("ErsatzTV.Core.Domain.Episode", b =>
                {
                    b.Navigation("EpisodeMetadata");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.Movie", b =>
                {
                    b.Navigation("MediaVersions");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.Season", b =>
                {
                    b.Navigation("Episodes");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.Show", b =>
                {
                    b.Navigation("Seasons");

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

            modelBuilder.Entity("ErsatzTV.Core.Domain.PlexMediaSource", b =>
                {
                    b.Navigation("Connections");

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