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

#nullable disable

namespace DramaLing.Api.Migrations
{
    [DbContext(typeof(DramaLingDbContext))]
    [Migration("20250924112240_AddImageGenerationTables")]
    partial class AddImageGenerationTables
    {
        /// <inheritdoc />
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder.HasAnnotation("ProductVersion", "8.0.10");

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

                    b.Property<string>("Accent")
                        .IsRequired()
                        .HasMaxLength(2)
                        .HasColumnType("TEXT");

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

                    b.Property<string>("AudioUrl")
                        .IsRequired()
                        .HasColumnType("TEXT")
                        .HasColumnName("audio_url");

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

                    b.Property<int?>("DurationMs")
                        .HasColumnType("INTEGER")
                        .HasColumnName("duration_ms");

                    b.Property<int?>("FileSize")
                        .HasColumnType("INTEGER")
                        .HasColumnName("file_size");

                    b.Property<DateTime>("LastAccessed")
                        .HasColumnType("TEXT")
                        .HasColumnName("last_accessed");

                    b.Property<string>("TextContent")
                        .IsRequired()
                        .HasColumnType("TEXT")
                        .HasColumnName("text_content");

                    b.Property<string>("TextHash")
                        .IsRequired()
                        .HasMaxLength(64)
                        .HasColumnType("TEXT")
                        .HasColumnName("text_hash");

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

                    b.HasKey("Id");

                    b.HasIndex("LastAccessed")
                        .HasDatabaseName("IX_AudioCache_LastAccessed");

                    b.HasIndex("TextHash")
                        .IsUnique()
                        .HasDatabaseName("IX_AudioCache_TextHash");

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

            modelBuilder.Entity("DramaLing.Api.Models.Entities.CardSet", b =>
                {
                    b.Property<Guid>("Id")
                        .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.ExampleImage", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT");

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

                    b.Property<string>("AltText")
                        .HasMaxLength(200)
                        .HasColumnType("TEXT")
                        .HasColumnName("alt_text");

                    b.Property<string>("ContentHash")
                        .HasMaxLength(64)
                        .HasColumnType("TEXT")
                        .HasColumnName("content_hash");

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

                    b.Property<int?>("FileSize")
                        .HasColumnType("INTEGER")
                        .HasColumnName("file_size");

                    b.Property<decimal?>("GeminiCost")
                        .HasColumnType("TEXT")
                        .HasColumnName("gemini_cost");

                    b.Property<string>("GeminiDescription")
                        .HasColumnType("TEXT")
                        .HasColumnName("gemini_description");

                    b.Property<string>("GeminiPrompt")
                        .HasColumnType("TEXT")
                        .HasColumnName("gemini_prompt");

                    b.Property<int?>("ImageHeight")
                        .HasColumnType("INTEGER")
                        .HasColumnName("image_height");

                    b.Property<int?>("ImageWidth")
                        .HasColumnType("INTEGER")
                        .HasColumnName("image_width");

                    b.Property<string>("ModerationNotes")
                        .HasColumnType("TEXT")
                        .HasColumnName("moderation_notes");

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

                    b.Property<decimal?>("QualityScore")
                        .HasColumnType("TEXT")
                        .HasColumnName("quality_score");

                    b.Property<string>("RelativePath")
                        .IsRequired()
                        .HasMaxLength(500)
                        .HasColumnType("TEXT")
                        .HasColumnName("relative_path");

                    b.Property<decimal?>("ReplicateCost")
                        .HasColumnType("TEXT")
                        .HasColumnName("replicate_cost");

                    b.Property<string>("ReplicateModel")
                        .HasMaxLength(100)
                        .HasColumnType("TEXT")
                        .HasColumnName("replicate_model");

                    b.Property<string>("ReplicatePrompt")
                        .HasColumnType("TEXT")
                        .HasColumnName("replicate_prompt");

                    b.Property<string>("ReplicateVersion")
                        .HasMaxLength(100)
                        .HasColumnType("TEXT")
                        .HasColumnName("replicate_version");

                    b.Property<decimal?>("TotalGenerationCost")
                        .HasColumnType("TEXT")
                        .HasColumnName("total_generation_cost");

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

                    b.HasKey("Id");

                    b.HasIndex("AccessCount");

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

                    b.ToTable("example_images", (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.FlashcardExampleImage", b =>
                {
                    b.Property<Guid>("FlashcardId")
                        .HasColumnType("TEXT")
                        .HasColumnName("flashcard_id");

                    b.Property<Guid>("ExampleImageId")
                        .HasColumnType("TEXT")
                        .HasColumnName("example_image_id");

                    b.Property<decimal?>("ContextRelevance")
                        .HasColumnType("TEXT")
                        .HasColumnName("context_relevance");

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

                    b.Property<int>("DisplayOrder")
                        .HasColumnType("INTEGER")
                        .HasColumnName("display_order");

                    b.Property<bool>("IsPrimary")
                        .HasColumnType("INTEGER")
                        .HasColumnName("is_primary");

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

                    b.HasIndex("ExampleImageId");

                    b.ToTable("flashcard_example_images", (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.ImageGenerationRequest", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT");

                    b.Property<DateTime?>("CompletedAt")
                        .HasColumnType("TEXT")
                        .HasColumnName("completed_at");

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

                    b.Property<string>("FinalReplicatePrompt")
                        .HasColumnType("TEXT")
                        .HasColumnName("final_replicate_prompt");

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

                    b.Property<DateTime?>("GeminiCompletedAt")
                        .HasColumnType("TEXT")
                        .HasColumnName("gemini_completed_at");

                    b.Property<decimal?>("GeminiCost")
                        .HasColumnType("TEXT")
                        .HasColumnName("gemini_cost");

                    b.Property<string>("GeminiErrorMessage")
                        .HasColumnType("TEXT")
                        .HasColumnName("gemini_error_message");

                    b.Property<int?>("GeminiProcessingTimeMs")
                        .HasColumnType("INTEGER")
                        .HasColumnName("gemini_processing_time_ms");

                    b.Property<string>("GeminiPrompt")
                        .HasColumnType("TEXT")
                        .HasColumnName("gemini_prompt");

                    b.Property<DateTime?>("GeminiStartedAt")
                        .HasColumnType("TEXT")
                        .HasColumnName("gemini_started_at");

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

                    b.Property<string>("GeneratedDescription")
                        .HasColumnType("TEXT")
                        .HasColumnName("generated_description");

                    b.Property<Guid?>("GeneratedImageId")
                        .HasColumnType("TEXT")
                        .HasColumnName("generated_image_id");

                    b.Property<string>("OriginalRequest")
                        .IsRequired()
                        .HasColumnType("TEXT")
                        .HasColumnName("original_request");

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

                    b.Property<DateTime?>("ReplicateCompletedAt")
                        .HasColumnType("TEXT")
                        .HasColumnName("replicate_completed_at");

                    b.Property<decimal?>("ReplicateCost")
                        .HasColumnType("TEXT")
                        .HasColumnName("replicate_cost");

                    b.Property<string>("ReplicateErrorMessage")
                        .HasColumnType("TEXT")
                        .HasColumnName("replicate_error_message");

                    b.Property<int?>("ReplicateProcessingTimeMs")
                        .HasColumnType("INTEGER")
                        .HasColumnName("replicate_processing_time_ms");

                    b.Property<DateTime?>("ReplicateStartedAt")
                        .HasColumnType("TEXT")
                        .HasColumnName("replicate_started_at");

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

                    b.Property<decimal?>("TotalCost")
                        .HasColumnType("TEXT")
                        .HasColumnName("total_cost");

                    b.Property<int?>("TotalProcessingTimeMs")
                        .HasColumnType("INTEGER")
                        .HasColumnName("total_processing_time_ms");

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

                    b.HasKey("Id");

                    b.HasIndex("FlashcardId");

                    b.HasIndex("GeneratedImageId");

                    b.HasIndex("UserId");

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

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

                    b.Property<decimal>("AccuracyScore")
                        .HasColumnType("TEXT")
                        .HasColumnName("accuracy_score");

                    b.Property<string>("AudioUrl")
                        .HasColumnType("TEXT")
                        .HasColumnName("audio_url");

                    b.Property<decimal>("CompletenessScore")
                        .HasColumnType("TEXT")
                        .HasColumnName("completeness_score");

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

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

                    b.Property<decimal>("FluencyScore")
                        .HasColumnType("TEXT")
                        .HasColumnName("fluency_score");

                    b.Property<int>("OverallScore")
                        .HasColumnType("INTEGER")
                        .HasColumnName("overall_score");

                    b.Property<string>("PhonemeScores")
                        .HasColumnType("TEXT")
                        .HasColumnName("phoneme_scores");

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

                    b.Property<decimal>("ProsodyScore")
                        .HasColumnType("TEXT")
                        .HasColumnName("prosody_score");

                    b.Property<Guid?>("StudySessionId")
                        .HasColumnType("TEXT")
                        .HasColumnName("study_session_id");

                    b.Property<string>("Suggestions")
                        .HasColumnType("TEXT")
                        .HasColumnName("suggestions");

                    b.Property<string>("TargetText")
                        .IsRequired()
                        .HasColumnType("TEXT")
                        .HasColumnName("target_text");

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

                    b.HasKey("Id");

                    b.HasIndex("FlashcardId");

                    b.HasIndex("StudySessionId")
                        .HasDatabaseName("IX_PronunciationAssessment_Session");

                    b.HasIndex("UserId", "FlashcardId")
                        .HasDatabaseName("IX_PronunciationAssessment_UserFlashcard");

                    b.ToTable("pronunciation_assessments", (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>("IdiomsDetected")
                        .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.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>("EnglishLevel")
                        .IsRequired()
                        .HasMaxLength(10)
                        .HasColumnType("TEXT")
                        .HasColumnName("english_level");

                    b.Property<bool>("IsLevelVerified")
                        .HasColumnType("INTEGER")
                        .HasColumnName("is_level_verified");

                    b.Property<string>("LevelNotes")
                        .HasMaxLength(500)
                        .HasColumnType("TEXT")
                        .HasColumnName("level_notes");

                    b.Property<DateTime>("LevelUpdatedAt")
                        .HasColumnType("TEXT")
                        .HasColumnName("level_updated_at");

                    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.UserAudioPreferences", b =>
                {
                    b.Property<Guid>("UserId")
                        .HasColumnType("TEXT");

                    b.Property<bool>("AutoPlayEnabled")
                        .HasColumnType("INTEGER")
                        .HasColumnName("auto_play_enabled");

                    b.Property<decimal>("DefaultSpeed")
                        .HasColumnType("TEXT")
                        .HasColumnName("default_speed");

                    b.Property<bool>("EnableDetailedFeedback")
                        .HasColumnType("INTEGER")
                        .HasColumnName("enable_detailed_feedback");

                    b.Property<string>("PreferredAccent")
                        .IsRequired()
                        .HasMaxLength(2)
                        .HasColumnType("TEXT")
                        .HasColumnName("preferred_accent");

                    b.Property<string>("PreferredVoiceFemale")
                        .HasMaxLength(50)
                        .HasColumnType("TEXT")
                        .HasColumnName("preferred_voice_female");

                    b.Property<string>("PreferredVoiceMale")
                        .HasMaxLength(50)
                        .HasColumnType("TEXT")
                        .HasColumnName("preferred_voice_male");

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

                    b.Property<int>("TargetScoreThreshold")
                        .HasColumnType("INTEGER")
                        .HasColumnName("target_score_threshold");

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

                    b.HasKey("UserId");

                    b.ToTable("user_audio_preferences", (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.WordQueryUsageStats", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT");

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

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

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

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("CreatedAt")
                        .HasDatabaseName("IX_WordQueryUsageStats_CreatedAt");

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

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

            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.SetNull);

                    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.FlashcardExampleImage", b =>
                {
                    b.HasOne("DramaLing.Api.Models.Entities.ExampleImage", "ExampleImage")
                        .WithMany("FlashcardExampleImages")
                        .HasForeignKey("ExampleImageId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

                    b.Navigation("ExampleImage");

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

            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.ImageGenerationRequest", b =>
                {
                    b.HasOne("DramaLing.Api.Models.Entities.Flashcard", "Flashcard")
                        .WithMany()
                        .HasForeignKey("FlashcardId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("DramaLing.Api.Models.Entities.ExampleImage", "GeneratedImage")
                        .WithMany()
                        .HasForeignKey("GeneratedImageId")
                        .OnDelete(DeleteBehavior.SetNull);

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

                    b.Navigation("Flashcard");

                    b.Navigation("GeneratedImage");

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

            modelBuilder.Entity("DramaLing.Api.Models.Entities.PronunciationAssessment", b =>
                {
                    b.HasOne("DramaLing.Api.Models.Entities.Flashcard", "Flashcard")
                        .WithMany()
                        .HasForeignKey("FlashcardId")
                        .OnDelete(DeleteBehavior.SetNull);

                    b.HasOne("DramaLing.Api.Models.Entities.StudySession", "StudySession")
                        .WithMany()
                        .HasForeignKey("StudySessionId")
                        .OnDelete(DeleteBehavior.SetNull);

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

                    b.Navigation("Flashcard");

                    b.Navigation("StudySession");

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

            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.UserAudioPreferences", b =>
                {
                    b.HasOne("DramaLing.Api.Models.Entities.User", "User")
                        .WithOne()
                        .HasForeignKey("DramaLing.Api.Models.Entities.UserAudioPreferences", "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.WordQueryUsageStats", 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.CardSet", b =>
                {
                    b.Navigation("Flashcards");
                });

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

            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
        }
    }
}
