//
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("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property("CardCount")
.HasColumnType("INTEGER");
b.Property("Color")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property("CreatedAt")
.HasColumnType("TEXT");
b.Property("Description")
.HasColumnType("TEXT");
b.Property("IsDefault")
.HasColumnType("INTEGER");
b.Property("Name")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("TEXT");
b.Property("UpdatedAt")
.HasColumnType("TEXT");
b.Property("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("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property("AiApiCalls")
.HasColumnType("INTEGER")
.HasColumnName("ai_api_calls");
b.Property("CardsGenerated")
.HasColumnType("INTEGER")
.HasColumnName("cards_generated");
b.Property("CreatedAt")
.HasColumnType("TEXT")
.HasColumnName("created_at");
b.Property("Date")
.HasColumnType("TEXT");
b.Property("SessionCount")
.HasColumnType("INTEGER")
.HasColumnName("session_count");
b.Property("StudyTimeSeconds")
.HasColumnType("INTEGER")
.HasColumnName("study_time_seconds");
b.Property("UserId")
.HasColumnType("TEXT")
.HasColumnName("user_id");
b.Property("WordsCorrect")
.HasColumnType("INTEGER")
.HasColumnName("words_correct");
b.Property("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("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property("AdminNotes")
.HasColumnType("TEXT")
.HasColumnName("admin_notes");
b.Property("CreatedAt")
.HasColumnType("TEXT")
.HasColumnName("created_at");
b.Property("Description")
.HasColumnType("TEXT");
b.Property("FlashcardId")
.HasColumnType("TEXT")
.HasColumnName("flashcard_id");
b.Property("ReportType")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT")
.HasColumnName("report_type");
b.Property("ResolvedAt")
.HasColumnType("TEXT")
.HasColumnName("resolved_at");
b.Property("ResolvedBy")
.HasColumnType("TEXT")
.HasColumnName("resolved_by");
b.Property("Status")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property("StudyMode")
.HasMaxLength(50)
.HasColumnType("TEXT")
.HasColumnName("study_mode");
b.Property("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("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property("CardSetId")
.HasColumnType("TEXT")
.HasColumnName("card_set_id");
b.Property("CreatedAt")
.HasColumnType("TEXT")
.HasColumnName("created_at");
b.Property("Definition")
.IsRequired()
.HasColumnType("TEXT");
b.Property("DifficultyLevel")
.HasMaxLength(10)
.HasColumnType("TEXT")
.HasColumnName("difficulty_level");
b.Property("EasinessFactor")
.HasColumnType("REAL")
.HasColumnName("easiness_factor");
b.Property("Example")
.HasColumnType("TEXT");
b.Property("ExampleTranslation")
.HasColumnType("TEXT")
.HasColumnName("example_translation");
b.Property("IntervalDays")
.HasColumnType("INTEGER")
.HasColumnName("interval_days");
b.Property("IsArchived")
.HasColumnType("INTEGER")
.HasColumnName("is_archived");
b.Property("IsFavorite")
.HasColumnType("INTEGER")
.HasColumnName("is_favorite");
b.Property("LastReviewedAt")
.HasColumnType("TEXT")
.HasColumnName("last_reviewed_at");
b.Property("MasteryLevel")
.HasColumnType("INTEGER")
.HasColumnName("mastery_level");
b.Property("NextReviewDate")
.HasColumnType("TEXT")
.HasColumnName("next_review_date");
b.Property("PartOfSpeech")
.HasMaxLength(50)
.HasColumnType("TEXT")
.HasColumnName("part_of_speech");
b.Property("Pronunciation")
.HasMaxLength(255)
.HasColumnType("TEXT");
b.Property("Repetitions")
.HasColumnType("INTEGER");
b.Property("TimesCorrect")
.HasColumnType("INTEGER")
.HasColumnName("times_correct");
b.Property("TimesReviewed")
.HasColumnType("INTEGER")
.HasColumnName("times_reviewed");
b.Property("Translation")
.IsRequired()
.HasColumnType("TEXT");
b.Property("UpdatedAt")
.HasColumnType("TEXT")
.HasColumnName("updated_at");
b.Property("UserId")
.HasColumnType("TEXT")
.HasColumnName("user_id");
b.Property("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("FlashcardId")
.HasColumnType("TEXT")
.HasColumnName("flashcard_id");
b.Property("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("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property("AccessCount")
.HasColumnType("INTEGER");
b.Property("AnalysisResult")
.IsRequired()
.HasColumnType("TEXT");
b.Property("CorrectedText")
.HasMaxLength(1000)
.HasColumnType("TEXT");
b.Property("CreatedAt")
.HasColumnType("TEXT");
b.Property("ExpiresAt")
.HasColumnType("TEXT");
b.Property("GrammarCorrections")
.HasColumnType("TEXT");
b.Property("HasGrammarErrors")
.HasColumnType("INTEGER");
b.Property("HighValueWords")
.HasColumnType("TEXT");
b.Property("InputText")
.IsRequired()
.HasMaxLength(1000)
.HasColumnType("TEXT");
b.Property("InputTextHash")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("TEXT");
b.Property("LastAccessedAt")
.HasColumnType("TEXT");
b.Property("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("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property("FlashcardId")
.HasColumnType("TEXT")
.HasColumnName("flashcard_id");
b.Property("IsCorrect")
.HasColumnType("INTEGER")
.HasColumnName("is_correct");
b.Property("NewEasinessFactor")
.HasColumnType("REAL");
b.Property("NewIntervalDays")
.HasColumnType("INTEGER");
b.Property("NewRepetitions")
.HasColumnType("INTEGER");
b.Property("NextReviewDate")
.HasColumnType("TEXT");
b.Property("PreviousEasinessFactor")
.HasColumnType("REAL");
b.Property("PreviousIntervalDays")
.HasColumnType("INTEGER");
b.Property("PreviousRepetitions")
.HasColumnType("INTEGER");
b.Property("QualityRating")
.HasColumnType("INTEGER")
.HasColumnName("quality_rating");
b.Property("ResponseTimeMs")
.HasColumnType("INTEGER")
.HasColumnName("response_time_ms");
b.Property("SessionId")
.HasColumnType("TEXT")
.HasColumnName("session_id");
b.Property("StudiedAt")
.HasColumnType("TEXT")
.HasColumnName("studied_at");
b.Property("StudyMode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT")
.HasColumnName("study_mode");
b.Property("UserAnswer")
.HasColumnType("TEXT")
.HasColumnName("user_answer");
b.Property("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("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property("AverageResponseTimeMs")
.HasColumnType("INTEGER")
.HasColumnName("average_response_time_ms");
b.Property("CorrectCount")
.HasColumnType("INTEGER")
.HasColumnName("correct_count");
b.Property("DurationSeconds")
.HasColumnType("INTEGER")
.HasColumnName("duration_seconds");
b.Property("EndedAt")
.HasColumnType("TEXT")
.HasColumnName("ended_at");
b.Property("SessionType")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT")
.HasColumnName("session_type");
b.Property("StartedAt")
.HasColumnType("TEXT")
.HasColumnName("started_at");
b.Property("TotalCards")
.HasColumnType("INTEGER")
.HasColumnName("total_cards");
b.Property("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("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property("Color")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property("CreatedAt")
.HasColumnType("TEXT")
.HasColumnName("created_at");
b.Property("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property("UsageCount")
.HasColumnType("INTEGER")
.HasColumnName("usage_count");
b.Property("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("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property("AvatarUrl")
.HasColumnType("TEXT")
.HasColumnName("avatar_url");
b.Property("CreatedAt")
.HasColumnType("TEXT")
.HasColumnName("created_at");
b.Property("DisplayName")
.HasMaxLength(100)
.HasColumnType("TEXT")
.HasColumnName("display_name");
b.Property("Email")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("TEXT")
.HasColumnName("email");
b.Property("PasswordHash")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("TEXT")
.HasColumnName("password_hash");
b.Property("Preferences")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("preferences");
b.Property("SubscriptionType")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("TEXT")
.HasColumnName("subscription_type");
b.Property("UpdatedAt")
.HasColumnType("TEXT")
.HasColumnName("updated_at");
b.Property("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("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property("AutoPlayAudio")
.HasColumnType("INTEGER");
b.Property("CreatedAt")
.HasColumnType("TEXT");
b.Property("DailyGoal")
.HasColumnType("INTEGER");
b.Property("DifficultyPreference")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("TEXT");
b.Property("ReminderEnabled")
.HasColumnType("INTEGER");
b.Property("ReminderTime")
.HasColumnType("TEXT");
b.Property("ShowPronunciation")
.HasColumnType("INTEGER");
b.Property("UpdatedAt")
.HasColumnType("TEXT");
b.Property("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
}
}
}