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

#nullable disable

namespace song_of_the_day.DataMigrations
{
    [DbContext(typeof(DataContext))]
    [Migration("20250720003809_fix auth token non-null contraint")]
    partial class fixauthtokennonnullcontraint
    {
        /// <inheritdoc />
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "9.0.3")
                .HasAnnotation("Relational:MaxIdentifierLength", 63);

            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);

            modelBuilder.Entity("SmartPlaylistDefinition", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("CreatedByUserId");

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

            modelBuilder.Entity("Song", b =>
                {
                    b.Property<int>("SongId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("SongId"));

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

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

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

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

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

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

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

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

                    b.HasKey("SongId");

                    b.HasIndex("SmartPlaylistDefinitionId");

                    b.HasIndex("SmartPlaylistDefinitionId1");

                    b.HasIndex("UserId");

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

            modelBuilder.Entity("SongSuggestion", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

                    b.Property<DateTime>("Date")
                        .HasColumnType("timestamp with time zone");

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("SongId");

                    b.HasIndex("SuggestionHelperId");

                    b.HasIndex("UserId");

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

            modelBuilder.Entity("SuggestionHelper", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("SmartPlaylistDefinitionId");

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

            modelBuilder.Entity("User", b =>
                {
                    b.Property<int>("UserId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("UserId"));

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

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

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

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

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

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

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

                    b.Property<DateTime?>("SpotifyAuthCreatedAt")
                        .HasColumnType("timestamp with time zone");

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

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

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

                    b.HasKey("UserId");

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

            modelBuilder.Entity("SmartPlaylistDefinition", b =>
                {
                    b.HasOne("User", "CreatedBy")
                        .WithMany()
                        .HasForeignKey("CreatedByUserId");

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

            modelBuilder.Entity("Song", b =>
                {
                    b.HasOne("SmartPlaylistDefinition", null)
                        .WithMany("ExplicitlyExcludedSongs")
                        .HasForeignKey("SmartPlaylistDefinitionId");

                    b.HasOne("SmartPlaylistDefinition", null)
                        .WithMany("ExplicitlyIncludedSongs")
                        .HasForeignKey("SmartPlaylistDefinitionId1");

                    b.HasOne("User", null)
                        .WithMany("LikedSongs")
                        .HasForeignKey("UserId");
                });

            modelBuilder.Entity("SongSuggestion", b =>
                {
                    b.HasOne("Song", "Song")
                        .WithMany()
                        .HasForeignKey("SongId");

                    b.HasOne("SuggestionHelper", "SuggestionHelper")
                        .WithMany()
                        .HasForeignKey("SuggestionHelperId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("User", "User")
                        .WithMany()
                        .HasForeignKey("UserId");

                    b.Navigation("Song");

                    b.Navigation("SuggestionHelper");

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

            modelBuilder.Entity("SuggestionHelper", b =>
                {
                    b.HasOne("SmartPlaylistDefinition", null)
                        .WithMany("Categories")
                        .HasForeignKey("SmartPlaylistDefinitionId");
                });

            modelBuilder.Entity("SmartPlaylistDefinition", b =>
                {
                    b.Navigation("Categories");

                    b.Navigation("ExplicitlyExcludedSongs");

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

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