dramaling-vocab-learning/backend/DramaLing.Api/Models/Entities/Flashcard.cs

71 lines
2.0 KiB
C#

using System.ComponentModel.DataAnnotations;
namespace DramaLing.Api.Models.Entities;
public class Flashcard
{
public Guid Id { get; set; }
public Guid UserId { get; set; }
public Guid? CardSetId { get; set; }
// 詞卡內容
[Required]
[MaxLength(255)]
public string Word { get; set; } = string.Empty;
[Required]
public string Translation { get; set; } = string.Empty;
[Required]
public string Definition { get; set; } = string.Empty;
[MaxLength(50)]
public string? PartOfSpeech { get; set; }
[MaxLength(255)]
public string? Pronunciation { get; set; }
public string? Example { get; set; }
public string? ExampleTranslation { get; set; }
// SM-2 算法參數
public float EasinessFactor { get; set; } = 2.5f;
public int Repetitions { get; set; } = 0;
public int IntervalDays { get; set; } = 1;
public DateTime NextReviewDate { get; set; } = DateTime.Today;
// 學習統計
[Range(0, 100)]
public int MasteryLevel { get; set; } = 0;
public int TimesReviewed { get; set; } = 0;
public int TimesCorrect { get; set; } = 0;
public DateTime? LastReviewedAt { get; set; }
// 狀態
public bool IsFavorite { get; set; } = false;
public bool IsArchived { get; set; } = false;
[MaxLength(10)]
public string? DifficultyLevel { get; set; } // A1, A2, B1, B2, C1, C2
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
// Navigation Properties
public virtual User User { get; set; } = null!;
public virtual CardSet? CardSet { get; set; }
public virtual ICollection<StudyRecord> StudyRecords { get; set; } = new List<StudyRecord>();
public virtual ICollection<FlashcardTag> FlashcardTags { get; set; } = new List<FlashcardTag>();
public virtual ICollection<ErrorReport> ErrorReports { get; set; } = new List<ErrorReport>();
public virtual ICollection<FlashcardExampleImage> FlashcardExampleImages { get; set; } = new List<FlashcardExampleImage>();
}