// <auto-generated />
using System;
using DataLayer;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

#nullable disable

namespace DataLayer.Migrations
{
    [DbContext(typeof(LibationContext))]
    partial class LibationContextModelSnapshot : ModelSnapshot
    {
        protected override void BuildModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder.HasAnnotation("ProductVersion", "10.0.2");

            modelBuilder.Entity("CategoryCategoryLadder", b =>
                {
                    b.Property<int>("_categoriesCategoryId")
                        .HasColumnType("INTEGER");

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

                    b.HasKey("_categoriesCategoryId", "_categoryLaddersCategoryLadderId");

                    b.HasIndex("_categoryLaddersCategoryLadderId");

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

            modelBuilder.Entity("DataLayer.Book", b =>
                {
                    b.Property<int>("BookId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

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

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

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

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

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

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

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

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

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

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

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

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

                    b.HasKey("BookId");

                    b.HasIndex("AudibleProductId");

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

            modelBuilder.Entity("DataLayer.BookCategory", b =>
                {
                    b.Property<int>("BookId")
                        .HasColumnType("INTEGER");

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

                    b.HasKey("BookId", "CategoryLadderId");

                    b.HasIndex("BookId");

                    b.HasIndex("CategoryLadderId");

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

            modelBuilder.Entity("DataLayer.BookContributor", b =>
                {
                    b.Property<int>("BookId")
                        .HasColumnType("INTEGER");

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

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

                    b.Property<byte>("Order")
                        .HasColumnType("INTEGER");

                    b.HasKey("BookId", "ContributorId", "Role");

                    b.HasIndex("BookId");

                    b.HasIndex("ContributorId");

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

            modelBuilder.Entity("DataLayer.Category", b =>
                {
                    b.Property<int>("CategoryId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

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

                    b.HasKey("CategoryId");

                    b.HasIndex("AudibleCategoryId");

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

            modelBuilder.Entity("DataLayer.CategoryLadder", b =>
                {
                    b.Property<int>("CategoryLadderId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

                    b.HasKey("CategoryLadderId");

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

            modelBuilder.Entity("DataLayer.Contributor", b =>
                {
                    b.Property<int>("ContributorId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

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

                    b.HasKey("ContributorId");

                    b.HasIndex("Name");

                    b.ToTable("Contributors");

                    b.HasData(
                        new
                        {
                            ContributorId = -1,
                            Name = ""
                        });
                });

            modelBuilder.Entity("DataLayer.LibraryBook", b =>
                {
                    b.Property<int>("BookId")
                        .HasColumnType("INTEGER");

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

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

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

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

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

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

                    b.HasKey("BookId");

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

            modelBuilder.Entity("DataLayer.Series", b =>
                {
                    b.Property<int>("SeriesId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

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

                    b.HasKey("SeriesId");

                    b.HasIndex("AudibleSeriesId");

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

            modelBuilder.Entity("DataLayer.SeriesBook", b =>
                {
                    b.Property<int>("SeriesId")
                        .HasColumnType("INTEGER");

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

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

                    b.HasKey("SeriesId", "BookId");

                    b.HasIndex("BookId");

                    b.HasIndex("SeriesId");

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

            modelBuilder.Entity("CategoryCategoryLadder", b =>
                {
                    b.HasOne("DataLayer.Category", null)
                        .WithMany()
                        .HasForeignKey("_categoriesCategoryId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("DataLayer.CategoryLadder", null)
                        .WithMany()
                        .HasForeignKey("_categoryLaddersCategoryLadderId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("DataLayer.Book", b =>
                {
                    b.OwnsOne("DataLayer.Rating", "Rating", b1 =>
                        {
                            b1.Property<int>("BookId")
                                .HasColumnType("INTEGER");

                            b1.Property<float>("OverallRating")
                                .HasColumnType("REAL");

                            b1.Property<float>("PerformanceRating")
                                .HasColumnType("REAL");

                            b1.Property<float>("StoryRating")
                                .HasColumnType("REAL");

                            b1.HasKey("BookId");

                            b1.ToTable("Books");

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

                    b.OwnsMany("DataLayer.Supplement", "Supplements", b1 =>
                        {
                            b1.Property<int>("SupplementId")
                                .ValueGeneratedOnAdd()
                                .HasColumnType("INTEGER");

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

                            b1.Property<string>("Url")
                                .IsRequired()
                                .HasColumnType("TEXT");

                            b1.HasKey("SupplementId");

                            b1.HasIndex("BookId");

                            b1.ToTable("Supplement");

                            b1.WithOwner("Book")
                                .HasForeignKey("BookId");

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

                    b.OwnsOne("DataLayer.UserDefinedItem", "UserDefinedItem", b1 =>
                        {
                            b1.Property<int>("BookId")
                                .HasColumnType("INTEGER");

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

                            b1.Property<bool>("IsFinished")
                                .HasColumnType("INTEGER");

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

                            b1.Property<string>("LastDownloadedFileVersion")
                                .HasColumnType("TEXT");

                            b1.Property<long?>("LastDownloadedFormat")
                                .HasColumnType("INTEGER");

                            b1.Property<string>("LastDownloadedVersion")
                                .HasColumnType("TEXT");

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

                            b1.Property<string>("Tags")
                                .IsRequired()
                                .HasColumnType("TEXT");

                            b1.HasKey("BookId");

                            b1.ToTable("UserDefinedItem", (string)null);

                            b1.WithOwner("Book")
                                .HasForeignKey("BookId");

                            b1.OwnsOne("DataLayer.Rating", "Rating", b2 =>
                                {
                                    b2.Property<int>("UserDefinedItemBookId")
                                        .HasColumnType("INTEGER");

                                    b2.Property<float>("OverallRating")
                                        .HasColumnType("REAL");

                                    b2.Property<float>("PerformanceRating")
                                        .HasColumnType("REAL");

                                    b2.Property<float>("StoryRating")
                                        .HasColumnType("REAL");

                                    b2.HasKey("UserDefinedItemBookId");

                                    b2.ToTable("UserDefinedItem");

                                    b2.WithOwner()
                                        .HasForeignKey("UserDefinedItemBookId");
                                });

                            b1.Navigation("Book");

                            b1.Navigation("Rating")
                                .IsRequired();
                        });

                    b.Navigation("Rating")
                        .IsRequired();

                    b.Navigation("Supplements");

                    b.Navigation("UserDefinedItem")
                        .IsRequired();
                });

            modelBuilder.Entity("DataLayer.BookCategory", b =>
                {
                    b.HasOne("DataLayer.Book", "Book")
                        .WithMany("CategoriesLink")
                        .HasForeignKey("BookId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("DataLayer.CategoryLadder", "CategoryLadder")
                        .WithMany("BooksLink")
                        .HasForeignKey("CategoryLadderId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Book");

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

            modelBuilder.Entity("DataLayer.BookContributor", b =>
                {
                    b.HasOne("DataLayer.Book", "Book")
                        .WithMany("ContributorsLink")
                        .HasForeignKey("BookId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("DataLayer.Contributor", "Contributor")
                        .WithMany("BooksLink")
                        .HasForeignKey("ContributorId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Book");

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

            modelBuilder.Entity("DataLayer.LibraryBook", b =>
                {
                    b.HasOne("DataLayer.Book", "Book")
                        .WithOne()
                        .HasForeignKey("DataLayer.LibraryBook", "BookId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("DataLayer.SeriesBook", b =>
                {
                    b.HasOne("DataLayer.Book", "Book")
                        .WithMany("SeriesLink")
                        .HasForeignKey("BookId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("DataLayer.Series", "Series")
                        .WithMany("BooksLink")
                        .HasForeignKey("SeriesId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Book");

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

            modelBuilder.Entity("DataLayer.Book", b =>
                {
                    b.Navigation("CategoriesLink");

                    b.Navigation("ContributorsLink");

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

            modelBuilder.Entity("DataLayer.CategoryLadder", b =>
                {
                    b.Navigation("BooksLink");
                });

            modelBuilder.Entity("DataLayer.Contributor", b =>
                {
                    b.Navigation("BooksLink");
                });

            modelBuilder.Entity("DataLayer.Series", b =>
                {
                    b.Navigation("BooksLink");
                });
#pragma warning restore 612, 618
        }
    }
}
