2025-07-15 16:30:01 +02:00

81 lines
2.1 KiB
C#

using Manager.DTOs;
using ManagerService.DTOs;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace ManagerService.Data.SubSection
{
/// <summary>
/// Quiz question
/// </summary>
public class QuizQuestion
{
[Key]
[Required]
public int Id { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<TranslationAndResourceDTO> Label { get; set; }
public string ResourceId { get; set; } // Background image id
public Resource Resource { get; set; } // Background image
public int Order { get; set; } // Order to show
[Required]
[Column(TypeName = "jsonb")]
public List<ResponseDTO> Responses { get; set; }
public string? SectionQuizId { get; set; }
[ForeignKey("SectionQuizId")]
public SectionQuiz? SectionQuiz { get; set; }
public string? GuidedStepId { get; set; }
[ForeignKey("GuidedStepId")]
public GuidedStep? GuidedStep { get; set; }
public QuestionType ValidationQuestionType { get; set; } = QuestionType.Simple;
public string? PuzzleImageId { get; set; }
public Resource? PuzzleImage { get; set; } // But only image is possible
public int? PuzzleRows { get; set; } = 3;
public int? PuzzleCols { get; set; } = 3;
public bool IsSlidingPuzzle { get; set; } = false;
// TODO
/*public TranslationDTO ToDTO()
{
return new TranslationDTO()
{
language = Language,
value = Value
};
}
public Translation FromDTO(TranslationDTO translationDTO)
{
return new Translation()
{
Language = translationDTO.language,
Value = translationDTO.value
};
}*/
}
public enum QuestionType
{
Simple, // Réponse texte libre
MultipleChoice, // Choix parmi plusieurs options
Puzzle
}
}