// <auto-generated />
using System;
using DramaLing.Api.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

#nullable disable

namespace DramaLing.Api.Migrations
{
    [DbContext(typeof(DramaLingDbContext))]
    partial class DramaLingDbContextModelSnapshot : ModelSnapshot
    {
        protected override void BuildModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder.HasAnnotation("ProductVersion", "8.0.10");

            modelBuilder.Entity("DramaLing.Api.Models.Entities.CardSet", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT");

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

                    b.Property<string>("Color")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("TEXT");

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("UserId");

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

            modelBuilder.Entity("DramaLing.Api.Models.Entities.DailyStats", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT");

                    b.Property<int>("AiApiCalls")
                        .HasColumnType("INTEGER")
                        .HasColumnName("ai_api_calls");

                    b.Property<int>("CardsGenerated")
                        .HasColumnType("INTEGER")
                        .HasColumnName("cards_generated");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("TEXT")
                        .HasColumnName("created_at");

                    b.Property<DateOnly>("Date")
                        .HasColumnType("TEXT");

                    b.Property<int>("SessionCount")
                        .HasColumnType("INTEGER")
                        .HasColumnName("session_count");

                    b.Property<int>("StudyTimeSeconds")
                        .HasColumnType("INTEGER")
                        .HasColumnName("study_time_seconds");

                    b.Property<Guid>("UserId")
                        .HasColumnType("TEXT")
                        .HasColumnName("user_id");

                    b.Property<int>("WordsCorrect")
                        .HasColumnType("INTEGER")
                        .HasColumnName("words_correct");

                    b.Property<int>("WordsStudied")
                        .HasColumnType("INTEGER")
                        .HasColumnName("words_studied");

                    b.HasKey("Id");

                    b.HasIndex("UserId", "Date")
                        .IsUnique();

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

            modelBuilder.Entity("DramaLing.Api.Models.Entities.ErrorReport", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT");

                    b.Property<string>("AdminNotes")
                        .HasColumnType("TEXT")
                        .HasColumnName("admin_notes");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("TEXT")
                        .HasColumnName("created_at");

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

                    b.Property<Guid>("FlashcardId")
                        .HasColumnType("TEXT")
                        .HasColumnName("flashcard_id");

                    b.Property<string>("ReportType")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("TEXT")
                        .HasColumnName("report_type");

                    b.Property<DateTime?>("ResolvedAt")
                        .HasColumnType("TEXT")
                        .HasColumnName("resolved_at");

                    b.Property<Guid?>("ResolvedBy")
                        .HasColumnType("TEXT")
                        .HasColumnName("resolved_by");

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("TEXT");

                    b.Property<string>("StudyMode")
                        .HasMaxLength(50)
                        .HasColumnType("TEXT")
                        .HasColumnName("study_mode");

                    b.Property<Guid>("UserId")
                        .HasColumnType("TEXT")
                        .HasColumnName("user_id");

                    b.HasKey("Id");

                    b.HasIndex("FlashcardId");

                    b.HasIndex("ResolvedBy");

                    b.HasIndex("UserId");

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

            modelBuilder.Entity("DramaLing.Api.Models.Entities.Flashcard", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT");

                    b.Property<Guid>("CardSetId")
                        .HasColumnType("TEXT")
                        .HasColumnName("card_set_id");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("TEXT")
                        .HasColumnName("created_at");

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

                    b.Property<string>("DifficultyLevel")
                        .HasMaxLength(10)
                        .HasColumnType("TEXT")
                        .HasColumnName("difficulty_level");

                    b.Property<float>("EasinessFactor")
                        .HasColumnType("REAL")
                        .HasColumnName("easiness_factor");

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

                    b.Property<string>("ExampleTranslation")
                        .HasColumnType("TEXT")
                        .HasColumnName("example_translation");

                    b.Property<int>("IntervalDays")
                        .HasColumnType("INTEGER")
                        .HasColumnName("interval_days");

                    b.Property<bool>("IsArchived")
                        .HasColumnType("INTEGER")
                        .HasColumnName("is_archived");

                    b.Property<bool>("IsFavorite")
                        .HasColumnType("INTEGER")
                        .HasColumnName("is_favorite");

                    b.Property<DateTime?>("LastReviewedAt")
                        .HasColumnType("TEXT")
                        .HasColumnName("last_reviewed_at");

                    b.Property<int>("MasteryLevel")
                        .HasColumnType("INTEGER")
                        .HasColumnName("mastery_level");

                    b.Property<DateTime>("NextReviewDate")
                        .HasColumnType("TEXT")
                        .HasColumnName("next_review_date");

                    b.Property<string>("PartOfSpeech")
                        .HasMaxLength(50)
                        .HasColumnType("TEXT")
                        .HasColumnName("part_of_speech");

                    b.Property<string>("Pronunciation")
                        .HasMaxLength(255)
                        .HasColumnType("TEXT");

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

                    b.Property<int>("TimesCorrect")
                        .HasColumnType("INTEGER")
                        .HasColumnName("times_correct");

                    b.Property<int>("TimesReviewed")
                        .HasColumnType("INTEGER")
                        .HasColumnName("times_reviewed");

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

                    b.Property<DateTime>("UpdatedAt")
                        .HasColumnType("TEXT")
                        .HasColumnName("updated_at");

                    b.Property<Guid>("UserId")
                        .HasColumnType("TEXT")
                        .HasColumnName("user_id");

                    b.Property<string>("Word")
                        .IsRequired()
                        .HasMaxLength(255)
                        .HasColumnType("TEXT");

                    b.HasKey("Id");

                    b.HasIndex("CardSetId");

                    b.HasIndex("UserId");

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

            modelBuilder.Entity("DramaLing.Api.Models.Entities.FlashcardTag", b =>
                {
                    b.Property<Guid>("FlashcardId")
                        .HasColumnType("TEXT")
                        .HasColumnName("flashcard_id");

                    b.Property<Guid>("TagId")
                        .HasColumnType("TEXT")
                        .HasColumnName("tag_id");

                    b.HasKey("FlashcardId", "TagId");

                    b.HasIndex("TagId");

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

            modelBuilder.Entity("DramaLing.Api.Models.Entities.SentenceAnalysisCache", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT");

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

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

                    b.Property<string>("CorrectedText")
                        .HasMaxLength(1000)
                        .HasColumnType("TEXT");

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

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

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

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

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

                    b.Property<string>("InputText")
                        .IsRequired()
                        .HasMaxLength(1000)
                        .HasColumnType("TEXT");

                    b.Property<string>("InputTextHash")
                        .IsRequired()
                        .HasMaxLength(64)
                        .HasColumnType("TEXT");

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

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

                    b.HasKey("Id");

                    b.HasIndex("ExpiresAt")
                        .HasDatabaseName("IX_SentenceAnalysisCache_Expires");

                    b.HasIndex("InputTextHash")
                        .HasDatabaseName("IX_SentenceAnalysisCache_Hash");

                    b.HasIndex("InputTextHash", "ExpiresAt")
                        .HasDatabaseName("IX_SentenceAnalysisCache_Hash_Expires");

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

            modelBuilder.Entity("DramaLing.Api.Models.Entities.StudyRecord", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT");

                    b.Property<Guid>("FlashcardId")
                        .HasColumnType("TEXT")
                        .HasColumnName("flashcard_id");

                    b.Property<bool>("IsCorrect")
                        .HasColumnType("INTEGER")
                        .HasColumnName("is_correct");

                    b.Property<float>("NewEasinessFactor")
                        .HasColumnType("REAL");

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

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

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

                    b.Property<float>("PreviousEasinessFactor")
                        .HasColumnType("REAL");

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

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

                    b.Property<int>("QualityRating")
                        .HasColumnType("INTEGER")
                        .HasColumnName("quality_rating");

                    b.Property<int?>("ResponseTimeMs")
                        .HasColumnType("INTEGER")
                        .HasColumnName("response_time_ms");

                    b.Property<Guid>("SessionId")
                        .HasColumnType("TEXT")
                        .HasColumnName("session_id");

                    b.Property<DateTime>("StudiedAt")
                        .HasColumnType("TEXT")
                        .HasColumnName("studied_at");

                    b.Property<string>("StudyMode")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("TEXT")
                        .HasColumnName("study_mode");

                    b.Property<string>("UserAnswer")
                        .HasColumnType("TEXT")
                        .HasColumnName("user_answer");

                    b.Property<Guid>("UserId")
                        .HasColumnType("TEXT")
                        .HasColumnName("user_id");

                    b.HasKey("Id");

                    b.HasIndex("FlashcardId");

                    b.HasIndex("SessionId");

                    b.HasIndex("UserId");

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

            modelBuilder.Entity("DramaLing.Api.Models.Entities.StudySession", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT");

                    b.Property<int>("AverageResponseTimeMs")
                        .HasColumnType("INTEGER")
                        .HasColumnName("average_response_time_ms");

                    b.Property<int>("CorrectCount")
                        .HasColumnType("INTEGER")
                        .HasColumnName("correct_count");

                    b.Property<int>("DurationSeconds")
                        .HasColumnType("INTEGER")
                        .HasColumnName("duration_seconds");

                    b.Property<DateTime?>("EndedAt")
                        .HasColumnType("TEXT")
                        .HasColumnName("ended_at");

                    b.Property<string>("SessionType")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("TEXT")
                        .HasColumnName("session_type");

                    b.Property<DateTime>("StartedAt")
                        .HasColumnType("TEXT")
                        .HasColumnName("started_at");

                    b.Property<int>("TotalCards")
                        .HasColumnType("INTEGER")
                        .HasColumnName("total_cards");

                    b.Property<Guid>("UserId")
                        .HasColumnType("TEXT")
                        .HasColumnName("user_id");

                    b.HasKey("Id");

                    b.HasIndex("UserId");

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

            modelBuilder.Entity("DramaLing.Api.Models.Entities.Tag", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT");

                    b.Property<string>("Color")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("TEXT");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("TEXT")
                        .HasColumnName("created_at");

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

                    b.Property<int>("UsageCount")
                        .HasColumnType("INTEGER")
                        .HasColumnName("usage_count");

                    b.Property<Guid>("UserId")
                        .HasColumnType("TEXT")
                        .HasColumnName("user_id");

                    b.HasKey("Id");

                    b.HasIndex("UserId");

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

            modelBuilder.Entity("DramaLing.Api.Models.Entities.User", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT");

                    b.Property<string>("AvatarUrl")
                        .HasColumnType("TEXT")
                        .HasColumnName("avatar_url");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("TEXT")
                        .HasColumnName("created_at");

                    b.Property<string>("DisplayName")
                        .HasMaxLength(100)
                        .HasColumnType("TEXT")
                        .HasColumnName("display_name");

                    b.Property<string>("Email")
                        .IsRequired()
                        .HasMaxLength(255)
                        .HasColumnType("TEXT")
                        .HasColumnName("email");

                    b.Property<string>("PasswordHash")
                        .IsRequired()
                        .HasMaxLength(255)
                        .HasColumnType("TEXT")
                        .HasColumnName("password_hash");

                    b.Property<string>("Preferences")
                        .IsRequired()
                        .HasColumnType("TEXT")
                        .HasColumnName("preferences");

                    b.Property<string>("SubscriptionType")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("TEXT")
                        .HasColumnName("subscription_type");

                    b.Property<DateTime>("UpdatedAt")
                        .HasColumnType("TEXT")
                        .HasColumnName("updated_at");

                    b.Property<string>("Username")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("TEXT")
                        .HasColumnName("username");

                    b.HasKey("Id");

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

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

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

            modelBuilder.Entity("DramaLing.Api.Models.Entities.UserSettings", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT");

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

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

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

                    b.Property<string>("DifficultyPreference")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("TEXT");

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

                    b.Property<TimeOnly>("ReminderTime")
                        .HasColumnType("TEXT");

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

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

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

                    b.HasKey("Id");

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

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

            modelBuilder.Entity("DramaLing.Api.Models.Entities.CardSet", b =>
                {
                    b.HasOne("DramaLing.Api.Models.Entities.User", "User")
                        .WithMany("CardSets")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("DramaLing.Api.Models.Entities.DailyStats", b =>
                {
                    b.HasOne("DramaLing.Api.Models.Entities.User", "User")
                        .WithMany("DailyStats")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("DramaLing.Api.Models.Entities.ErrorReport", b =>
                {
                    b.HasOne("DramaLing.Api.Models.Entities.Flashcard", "Flashcard")
                        .WithMany("ErrorReports")
                        .HasForeignKey("FlashcardId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("DramaLing.Api.Models.Entities.User", "ResolvedByUser")
                        .WithMany()
                        .HasForeignKey("ResolvedBy")
                        .OnDelete(DeleteBehavior.SetNull);

                    b.HasOne("DramaLing.Api.Models.Entities.User", "User")
                        .WithMany("ErrorReports")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Flashcard");

                    b.Navigation("ResolvedByUser");

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

            modelBuilder.Entity("DramaLing.Api.Models.Entities.Flashcard", b =>
                {
                    b.HasOne("DramaLing.Api.Models.Entities.CardSet", "CardSet")
                        .WithMany("Flashcards")
                        .HasForeignKey("CardSetId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("DramaLing.Api.Models.Entities.User", "User")
                        .WithMany("Flashcards")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("CardSet");

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

            modelBuilder.Entity("DramaLing.Api.Models.Entities.FlashcardTag", b =>
                {
                    b.HasOne("DramaLing.Api.Models.Entities.Flashcard", "Flashcard")
                        .WithMany("FlashcardTags")
                        .HasForeignKey("FlashcardId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("DramaLing.Api.Models.Entities.Tag", "Tag")
                        .WithMany("FlashcardTags")
                        .HasForeignKey("TagId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Flashcard");

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

            modelBuilder.Entity("DramaLing.Api.Models.Entities.StudyRecord", b =>
                {
                    b.HasOne("DramaLing.Api.Models.Entities.Flashcard", "Flashcard")
                        .WithMany("StudyRecords")
                        .HasForeignKey("FlashcardId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("DramaLing.Api.Models.Entities.StudySession", "Session")
                        .WithMany("StudyRecords")
                        .HasForeignKey("SessionId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("DramaLing.Api.Models.Entities.User", "User")
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Flashcard");

                    b.Navigation("Session");

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

            modelBuilder.Entity("DramaLing.Api.Models.Entities.StudySession", b =>
                {
                    b.HasOne("DramaLing.Api.Models.Entities.User", "User")
                        .WithMany("StudySessions")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("DramaLing.Api.Models.Entities.Tag", b =>
                {
                    b.HasOne("DramaLing.Api.Models.Entities.User", "User")
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("DramaLing.Api.Models.Entities.UserSettings", b =>
                {
                    b.HasOne("DramaLing.Api.Models.Entities.User", "User")
                        .WithOne("Settings")
                        .HasForeignKey("DramaLing.Api.Models.Entities.UserSettings", "UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("DramaLing.Api.Models.Entities.CardSet", b =>
                {
                    b.Navigation("Flashcards");
                });

            modelBuilder.Entity("DramaLing.Api.Models.Entities.Flashcard", b =>
                {
                    b.Navigation("ErrorReports");

                    b.Navigation("FlashcardTags");

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

            modelBuilder.Entity("DramaLing.Api.Models.Entities.StudySession", b =>
                {
                    b.Navigation("StudyRecords");
                });

            modelBuilder.Entity("DramaLing.Api.Models.Entities.Tag", b =>
                {
                    b.Navigation("FlashcardTags");
                });

            modelBuilder.Entity("DramaLing.Api.Models.Entities.User", b =>
                {
                    b.Navigation("CardSets");

                    b.Navigation("DailyStats");

                    b.Navigation("ErrorReports");

                    b.Navigation("Flashcards");

                    b.Navigation("Settings");

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