// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Modules.Library.Database.Database;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

#nullable disable

namespace Modules.Library.Database.Migrations
{
    [DbContext(typeof(LibraryDbContext))]
    [Migration("20250114211854_M006")]
    partial class M006
    {
        /// <inheritdoc />
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "8.0.10")
                .HasAnnotation("Relational:MaxIdentifierLength", 63);

            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);

            modelBuilder.Entity("Modules.Library.Database.Database.Models.Anime.AnimeItem", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("AnimeTitleId");

                    b.ToTable("AnimeItem");

                    b.UseTpcMappingStrategy();
                });

            modelBuilder.Entity("Modules.Library.Database.Database.Models.Anime.AnimeTitle", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

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

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

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

                    b.HasKey("Id");

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

            modelBuilder.Entity("Modules.Library.Database.Database.Models.CommonProperties.CommonProperties", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

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

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

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

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

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

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

                    b.HasKey("Id");

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

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

                    b.HasIndex("PreviewId");

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

            modelBuilder.Entity("Modules.Library.Database.Database.Models.CommonProperties.DescriptionItem", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("CommonPropertiesId");

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

            modelBuilder.Entity("Modules.Library.Database.Database.Models.CommonProperties.GenreProportionItem", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

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

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

                    b.Property<decimal?>("Proportion")
                        .HasColumnType("numeric");

                    b.HasKey("Id");

                    b.HasIndex("CommonPropertiesId");

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

            modelBuilder.Entity("Modules.Library.Database.Database.Models.CommonProperties.NameItem", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("CommonPropertiesId");

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

            modelBuilder.Entity("Modules.Library.Database.Database.Models.Genre.Genre", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

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

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

                    b.HasKey("Id");

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

            modelBuilder.Entity("Modules.Library.Database.Database.Models.Language.Language", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

                    b.Property<string>("CodeIso3")
                        .IsRequired()
                        .HasMaxLength(3)
                        .HasColumnType("character varying(3)");

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

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

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

                    b.HasKey("Id");

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

            modelBuilder.Entity("Modules.Library.Database.Database.Models.MediaInfo", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("CommonPropertiesId");

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

            modelBuilder.Entity("Modules.Library.Database.Database.Models.Anime.AnimeEpisode", b =>
                {
                    b.HasBaseType("Modules.Library.Database.Database.Models.Anime.AnimeItem");

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

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

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

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

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

                    b.HasIndex("SeasonId");

                    b.ToTable("Anime_Episodes", (string)null);
                });

            modelBuilder.Entity("Modules.Library.Database.Database.Models.Anime.AnimeSeason", b =>
                {
                    b.HasBaseType("Modules.Library.Database.Database.Models.Anime.AnimeItem");

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

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

                    b.Property<string>("OriginCountry")
                        .HasMaxLength(64)
                        .HasColumnType("character varying(64)");

                    b.ToTable("Anime_Seasons", (string)null);
                });

            modelBuilder.Entity("Modules.Library.Database.Database.Models.Anime.AnimeItem", b =>
                {
                    b.HasOne("Modules.Library.Database.Database.Models.Anime.AnimeTitle", "Title")
                        .WithMany("Items")
                        .HasForeignKey("AnimeTitleId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("Modules.Library.Database.Database.Models.CommonProperties.CommonProperties", b =>
                {
                    b.HasOne("Modules.Library.Database.Database.Models.Anime.AnimeItem", null)
                        .WithOne("CommonProperties")
                        .HasForeignKey("Modules.Library.Database.Database.Models.CommonProperties.CommonProperties", "AnimeItemId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("Modules.Library.Database.Database.Models.Anime.AnimeTitle", null)
                        .WithOne("CommonProperties")
                        .HasForeignKey("Modules.Library.Database.Database.Models.CommonProperties.CommonProperties", "AnimeTitleId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("Modules.Library.Database.Database.Models.MediaInfo", "Preview")
                        .WithMany()
                        .HasForeignKey("PreviewId")
                        .OnDelete(DeleteBehavior.Cascade);

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

            modelBuilder.Entity("Modules.Library.Database.Database.Models.CommonProperties.DescriptionItem", b =>
                {
                    b.HasOne("Modules.Library.Database.Database.Models.CommonProperties.CommonProperties", null)
                        .WithMany("Descriptions")
                        .HasForeignKey("CommonPropertiesId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("Modules.Library.Database.Database.Models.CommonProperties.GenreProportionItem", b =>
                {
                    b.HasOne("Modules.Library.Database.Database.Models.CommonProperties.CommonProperties", null)
                        .WithMany("Genres")
                        .HasForeignKey("CommonPropertiesId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("Modules.Library.Database.Database.Models.CommonProperties.NameItem", b =>
                {
                    b.HasOne("Modules.Library.Database.Database.Models.CommonProperties.CommonProperties", null)
                        .WithMany("Names")
                        .HasForeignKey("CommonPropertiesId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("Modules.Library.Database.Database.Models.MediaInfo", b =>
                {
                    b.HasOne("Modules.Library.Database.Database.Models.CommonProperties.CommonProperties", null)
                        .WithMany("RelatedContent")
                        .HasForeignKey("CommonPropertiesId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("Modules.Library.Database.Database.Models.Anime.AnimeEpisode", b =>
                {
                    b.HasOne("Modules.Library.Database.Database.Models.Anime.AnimeSeason", "Season")
                        .WithMany("Episodes")
                        .HasForeignKey("SeasonId")
                        .OnDelete(DeleteBehavior.Cascade);

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

            modelBuilder.Entity("Modules.Library.Database.Database.Models.Anime.AnimeItem", b =>
                {
                    b.Navigation("CommonProperties")
                        .IsRequired();
                });

            modelBuilder.Entity("Modules.Library.Database.Database.Models.Anime.AnimeTitle", b =>
                {
                    b.Navigation("CommonProperties")
                        .IsRequired();

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

            modelBuilder.Entity("Modules.Library.Database.Database.Models.CommonProperties.CommonProperties", b =>
                {
                    b.Navigation("Descriptions");

                    b.Navigation("Genres");

                    b.Navigation("Names");

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

            modelBuilder.Entity("Modules.Library.Database.Database.Models.Anime.AnimeSeason", b =>
                {
                    b.Navigation("Episodes");
                });
#pragma warning restore 612, 618
        }
    }
}
