using MongoDB.Bson; using MongoDB.Bson.Serialization.Attributes; namespace QuestionsApi.Models; public sealed class DynamicQuestionBlueprint { [BsonId] [BsonRepresentation(BsonType.ObjectId)] public string? Id { get; set; } public string ExternalId { get; set; } = ""; public int Version { get; set; } = 1; public string ObjectiveId { get; set; } = ""; public string Title { get; set; } = ""; public string System { get; set; } = ""; public string Discipline { get; set; } = ""; public string PerformanceCategory { get; set; } = ""; public string PhysicianTask { get; set; } = ""; public string EncounterFrame { get; set; } = ""; public string SiteOfCare { get; set; } = ""; public double BlueprintWeight { get; set; } public List ConceptIds { get; set; } = []; public List PrerequisiteConceptIds { get; set; } = []; public DateTime? MedicallyReviewedUtc { get; set; } public DateTime? MedicalReviewExpiresUtc { get; set; } public string MedicalReviewer { get; set; } = ""; public int Difficulty { get; set; } = 3; public int QualityStandardVersion { get; set; } = 1; public string CorrectConceptId { get; set; } = ""; public int BaseBlueprintVersion { get; set; } public bool IsPublished { get; set; } = true; public string StemTemplate { get; set; } = ""; public string LeadIn { get; set; } = ""; public Dictionary Variables { get; set; } = []; public Dictionary Derived { get; set; } = []; public List Constraints { get; set; } = []; public List Labs { get; set; } = []; public DynamicAnswerTemplate CorrectAnswer { get; set; } = new(); public List Distractors { get; set; } = []; public string ExplanationTemplate { get; set; } = ""; public string KeyTakeaway { get; set; } = ""; public string UsmlePearl { get; set; } = ""; public List References { get; set; } = []; public List Tags { get; set; } = []; public List ReviewFollowups { get; set; } = []; public Dictionary WrongAnswerFollowups { get; set; } = []; public List CaseFamilies { get; set; } = []; } public sealed class DynamicCaseFamily { public string Id { get; set; } = ""; public string BaseFamilyId { get; set; } = ""; public string DifficultyTier { get; set; } = "standard"; public int NominalElo { get; set; } = 1050; public string StemTemplate { get; set; } = ""; public string LeadIn { get; set; } = ""; public Dictionary Variables { get; set; } = []; public List> ValueBundles { get; set; } = []; public Dictionary Derived { get; set; } = []; public List Constraints { get; set; } = []; public List Labs { get; set; } = []; public DynamicAnswerTemplate CorrectAnswer { get; set; } = new(); public List Distractors { get; set; } = []; public string ExplanationTemplate { get; set; } = ""; public string KeyTakeaway { get; set; } = ""; public string UsmlePearl { get; set; } = ""; public List ReviewFollowups { get; set; } = []; public Dictionary WrongAnswerFollowups { get; set; } = []; } public sealed class DynamicReviewFollowupTemplate { public string PromptTemplate { get; set; } = ""; public List Choices { get; set; } = []; public string CorrectChoiceId { get; set; } = ""; public string TeachingPointTemplate { get; set; } = ""; } public sealed class DynamicWrongAnswerFollowupTemplate { public string PromptTemplate { get; set; } = ""; public List Choices { get; set; } = []; public string CorrectChoiceId { get; set; } = ""; public string TeachingPointTemplate { get; set; } = ""; } public sealed class DynamicVariableDefinition { public string Type { get; set; } = "integer"; public double Minimum { get; set; } public double Maximum { get; set; } public double Step { get; set; } = 1; public int Precision { get; set; } public List Values { get; set; } = []; } public sealed class DynamicDerivedDefinition { public string Operation { get; set; } = ""; public string Left { get; set; } = ""; public string Right { get; set; } = ""; public int Precision { get; set; } } public sealed class DynamicConstraint { public string Field { get; set; } = ""; public string Operator { get; set; } = ""; public double Value { get; set; } } public sealed class DynamicLabTemplate { public string Name { get; set; } = ""; public string ValueTemplate { get; set; } = ""; public string Unit { get; set; } = ""; public string Reference { get; set; } = ""; } public sealed class DynamicAnswerTemplate { public string Id { get; set; } = ""; public string TextTemplate { get; set; } = ""; public string ExplanationTemplate { get; set; } = ""; public string MisconceptionId { get; set; } = ""; public List RemediationConceptIds { get; set; } = []; } public sealed class DynamicGenerationClaims { public string UserId { get; set; } = ""; public string BlueprintExternalId { get; set; } = ""; public int BlueprintVersion { get; set; } public string ObjectiveId { get; set; } = ""; public string Seed { get; set; } = ""; public string Nonce { get; set; } = ""; public int GeneratorVersion { get; set; } = 1; public string CaseFamilyId { get; set; } = ""; public string DifficultyTier { get; set; } = ""; public int EffectiveAbilityElo { get; set; } public int FamilyElo { get; set; } public bool IsScheduledReview { get; set; } public string ReviewItemId { get; set; } = ""; public int ReviewStage { get; set; } public DateTime ExpiresUtc { get; set; } } public sealed class DynamicRunClaims { public string UserId { get; set; } = ""; public List SeenObjectiveIds { get; set; } = []; public string PreviousObjectiveId { get; set; } = ""; public int Cycle { get; set; } public List RecentCaseFamilyIds { get; set; } = []; public DateTime ExpiresUtc { get; set; } } public sealed class DynamicGeneratedQuestion { public Question Question { get; set; } = new(); public DynamicQuestionBlueprint Blueprint { get; set; } = new(); public string CaseFamilyId { get; set; } = ""; } public sealed class DynamicQuestionEnvelope { public QuestionResponse Question { get; set; } = new(); public string Source { get; set; } = "dynamic"; public string ObjectiveId { get; set; } = ""; public string ObjectiveTitle { get; set; } = ""; public string GenerationToken { get; set; } = ""; public string RunToken { get; set; } = ""; public int CycleSeen { get; set; } public int TotalObjectives { get; set; } } public sealed class DynamicNextRequest { public string RunToken { get; set; } = ""; } public sealed class DynamicAttemptRequest { public string GenerationToken { get; set; } = ""; public string ChoiceId { get; set; } = ""; public bool IsSkip { get; set; } public int DurationSeconds { get; set; } } public sealed class DynamicAttemptResponse { public bool Inserted { get; set; } public bool IsCorrect { get; set; } public string CorrectChoiceId { get; set; } = ""; public string ObjectiveId { get; set; } = ""; public int ObjectiveElo { get; set; } public int RatingChange { get; set; } public string SelectedMisconceptionId { get; set; } = ""; public bool IsScheduledReview { get; set; } public DateTime? NextReviewUtc { get; set; } } public sealed class DynamicReportRequest { public string GenerationToken { get; set; } = ""; public string Category { get; set; } = ""; public string Details { get; set; } = ""; } public sealed class DynamicQuestionStatusResponse { public bool Available { get; set; } public int PublishedObjectives { get; set; } public int AttemptedObjectives { get; set; } public int TotalAttempts { get; set; } public int AverageObjectiveElo { get; set; } = 1000; public int ReviewsDue { get; set; } public List SystemCoverage { get; set; } = []; public List PhysicianTaskCoverage { get; set; } = []; } public sealed class DynamicCoverageSummary { public string Id { get; set; } = ""; public int PublishedObjectives { get; set; } public int AttemptedObjectives { get; set; } public int Attempts { get; set; } public double CoveragePercent { get; set; } public int AverageElo { get; set; } = 1000; } public sealed class DynamicQuestionAttempt { [BsonId] [BsonRepresentation(BsonType.ObjectId)] public string? Id { get; set; } public string UserId { get; set; } = ""; public string Nonce { get; set; } = ""; public string BlueprintExternalId { get; set; } = ""; public int BlueprintVersion { get; set; } public string ObjectiveId { get; set; } = ""; public string CaseFamilyId { get; set; } = ""; public string DifficultyTier { get; set; } = ""; public int EffectiveAbilityElo { get; set; } public int FamilyElo { get; set; } public string ChoiceId { get; set; } = ""; public bool IsCorrect { get; set; } public bool IsSkip { get; set; } public string SelectedMisconceptionId { get; set; } = ""; public bool IsScheduledReview { get; set; } public int DurationSeconds { get; set; } public DateTime CreatedUtc { get; set; } = DateTime.UtcNow; } public static class DynamicReviewStates { public const string Pending = "pending"; public const string Mastered = "mastered"; } public sealed class DynamicReviewItem { [BsonId] [BsonRepresentation(BsonType.ObjectId)] public string? Id { get; set; } public string UserId { get; set; } = ""; public string ObjectiveId { get; set; } = ""; public string BlueprintExternalId { get; set; } = ""; public int BlueprintVersion { get; set; } public string MisconceptionId { get; set; } = ""; public string State { get; set; } = DynamicReviewStates.Pending; public int Stage { get; set; } public int ReviewCount { get; set; } public DateTime DueUtc { get; set; } public DateTime CreatedUtc { get; set; } = DateTime.UtcNow; public DateTime UpdatedUtc { get; set; } = DateTime.UtcNow; } public sealed class DynamicObjectiveMastery { [BsonId] [BsonRepresentation(BsonType.ObjectId)] public string? Id { get; set; } public string UserId { get; set; } = ""; public string ObjectiveId { get; set; } = ""; public int Elo { get; set; } = 1000; public int Attempts { get; set; } public int Correct { get; set; } public DateTime LastSeenUtc { get; set; } } public sealed class DynamicFamilyRating { [BsonId] [BsonRepresentation(BsonType.ObjectId)] public string? Id { get; set; } public string BlueprintExternalId { get; set; } = ""; public int BlueprintVersion { get; set; } public string CaseFamilyId { get; set; } = ""; public string DifficultyTier { get; set; } = ""; public int NominalElo { get; set; } public int Elo { get; set; } public int Attempts { get; set; } public int Correct { get; set; } public DateTime UpdatedUtc { get; set; } = DateTime.UtcNow; } public sealed class DynamicGenerationDescriptor { public string BlueprintExternalId { get; set; } = ""; public int BlueprintVersion { get; set; } public int GeneratorVersion { get; set; } public string Seed { get; set; } = ""; public string CaseFamilyId { get; set; } = ""; public string DifficultyTier { get; set; } = ""; public int FamilyElo { get; set; } public int EffectiveAbilityElo { get; set; } }