You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
902 B
Go
43 lines
902 B
Go
package question
|
|
|
|
import "time"
|
|
|
|
// Difficulty represents the question difficulty level.
|
|
type Difficulty string
|
|
|
|
const (
|
|
DifficultyEasy Difficulty = "easy"
|
|
DifficultyMedium Difficulty = "medium"
|
|
DifficultyHard Difficulty = "hard"
|
|
)
|
|
|
|
// Question represents a question aggregate root.
|
|
type Question struct {
|
|
ID string
|
|
Theme string
|
|
Text string
|
|
Answer string
|
|
Hint string
|
|
Difficulty Difficulty
|
|
IsActive bool
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
// RandomFilter defines supported filters for random question retrieval.
|
|
type RandomFilter struct {
|
|
ExcludeQuestionIDs []string
|
|
Theme string
|
|
Difficulty Difficulty
|
|
}
|
|
|
|
// IsValidDifficulty checks whether difficulty is supported.
|
|
func IsValidDifficulty(d Difficulty) bool {
|
|
switch d {
|
|
case DifficultyEasy, DifficultyMedium, DifficultyHard:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|