namespace GermanApp.Domain.Entities;
///
/// Represents a German language lesson in the system.
///
public class Lesson
{
// Private setter for domain behavior, but internal for EF Core
public int Id { get; private set; }
public string Title { get; private set; } = string.Empty;
public string Description { get; private set; } = string.Empty;
public int Level { get; private set; }
public DateTime CreatedAt { get; private set; }
public DateTime? UpdatedAt { get; private set; }
// Navigation properties would go here in EF Core
// public ICollection Words { get; private set; }
///
/// Constructor for EF Core deserialization.
///
private Lesson() { }
///
/// Factory method to create a new lesson.
///
public static Lesson Create(string title, string description, int level)
{
return new Lesson
{
Title = title,
Description = description,
Level = level,
CreatedAt = DateTime.UtcNow
};
}
///
/// Updates the lesson details.
///
public void Update(string title, string description, int level)
{
Title = title;
Description = description;
Level = level;
UpdatedAt = DateTime.UtcNow;
}
///
/// Domain behavior: Check if lesson is at beginner level.
///
public bool IsBeginnerLevel() => Level <= 2;
///
/// Domain behavior: Check if lesson is at advanced level.
///
public bool IsAdvancedLevel() => Level >= 4;
}