107 lines
4.0 KiB
C#
107 lines
4.0 KiB
C#
using MongoDB.Bson;
|
|
using MongoDB.Bson.Serialization.Attributes;
|
|
|
|
namespace QuestionsApi.Models;
|
|
|
|
public static class StudyGoalTypes
|
|
{
|
|
public const string QuestionCount = "question_count";
|
|
public const string Duration = "duration";
|
|
public const string WeakSystem = "weak_system";
|
|
public const string DueReviews = "due_reviews";
|
|
public const string SimulationBlock = "simulation_block";
|
|
public static readonly HashSet<string> All = [QuestionCount, Duration, WeakSystem, DueReviews, SimulationBlock];
|
|
}
|
|
|
|
public static class StudySessionStates
|
|
{
|
|
public const string Active = "active";
|
|
public const string Completed = "completed";
|
|
public const string EndedEarly = "ended_early";
|
|
public const string Interrupted = "interrupted";
|
|
}
|
|
|
|
public sealed class StudySession
|
|
{
|
|
[BsonId]
|
|
[BsonRepresentation(BsonType.ObjectId)]
|
|
public string? Id { get; set; }
|
|
public string UserId { get; set; } = "";
|
|
public string ClientSessionId { get; set; } = "";
|
|
public string GoalType { get; set; } = StudyGoalTypes.QuestionCount;
|
|
public string Mode { get; set; } = "Tutor";
|
|
public string Step3System { get; set; } = "";
|
|
public int TargetValue { get; set; } = 10;
|
|
public string State { get; set; } = StudySessionStates.Active;
|
|
public int QuestionsCompleted { get; set; }
|
|
public int Correct { get; set; }
|
|
public int ReviewsCompleted { get; set; }
|
|
public int Recovered { get; set; }
|
|
public int CoinsEarned { get; set; }
|
|
public List<CreditAward> CoinAwards { get; set; } = [];
|
|
public List<string> AppliedEventIds { get; set; } = [];
|
|
public int? InitialMasteryScore { get; set; }
|
|
public string InitialMasteryState { get; set; } = "";
|
|
public int? FinalMasteryScore { get; set; }
|
|
public string FinalMasteryState { get; set; } = "";
|
|
public int? InitialReadiness { get; set; }
|
|
public int? FinalReadiness { get; set; }
|
|
public string SimulationId { get; set; } = "";
|
|
public int? SimulationBlock { get; set; }
|
|
public DateTime CreatedUtc { get; set; }
|
|
public DateTime UpdatedUtc { get; set; }
|
|
public DateTime? TargetEndUtc { get; set; }
|
|
public DateTime? CompletedUtc { get; set; }
|
|
}
|
|
|
|
public sealed class CreateStudySessionRequest
|
|
{
|
|
public string ClientSessionId { get; set; } = "";
|
|
public string GoalType { get; set; } = StudyGoalTypes.QuestionCount;
|
|
public int TargetValue { get; set; } = 10;
|
|
public string Mode { get; set; } = "Tutor";
|
|
public string Step3System { get; set; } = "";
|
|
}
|
|
|
|
public sealed class StudySessionProgress
|
|
{
|
|
public string Id { get; set; } = "";
|
|
public string State { get; set; } = "";
|
|
public string GoalType { get; set; } = "";
|
|
public int TargetValue { get; set; }
|
|
public int CompletedValue { get; set; }
|
|
public int QuestionsCompleted { get; set; }
|
|
public int SecondsRemaining { get; set; }
|
|
public bool GoalReached { get; set; }
|
|
}
|
|
|
|
public sealed class StudySessionSummary
|
|
{
|
|
public string Id { get; set; } = "";
|
|
public string State { get; set; } = "";
|
|
public string GoalType { get; set; } = "";
|
|
public int TargetValue { get; set; }
|
|
public int CompletedValue { get; set; }
|
|
public int QuestionsCompleted { get; set; }
|
|
public int Correct { get; set; }
|
|
public int Accuracy { get; set; }
|
|
public int ReviewsCompleted { get; set; }
|
|
public int Recovered { get; set; }
|
|
public int ElapsedSeconds { get; set; }
|
|
public int CoinsEarned { get; set; }
|
|
public List<CreditAward> CoinAwards { get; set; } = [];
|
|
public string Step3System { get; set; } = "";
|
|
public int? MasteryScoreChange { get; set; }
|
|
public string InitialMasteryState { get; set; } = "";
|
|
public string FinalMasteryState { get; set; } = "";
|
|
public int? ReadinessChange { get; set; }
|
|
public string ReadinessExplanation { get; set; } = "A completed exam simulation is required to update readiness.";
|
|
public bool GoalBonusAwarded { get; set; }
|
|
}
|
|
|
|
public sealed class StudySessionEnvelope
|
|
{
|
|
public StudySessionProgress Progress { get; set; } = new();
|
|
public StudySessionSummary? Summary { get; set; }
|
|
}
|