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.
91 lines
2.7 KiB
Go
91 lines
2.7 KiB
Go
package session
|
|
|
|
import "time"
|
|
|
|
// StartSessionInput captures requested session start preferences.
|
|
type StartSessionInput struct {
|
|
PlayerID string
|
|
BearerToken string
|
|
PreferredTheme string
|
|
Difficulty string
|
|
}
|
|
|
|
// EndSessionInput captures session end request.
|
|
type EndSessionInput struct {
|
|
SessionID string
|
|
Reason string
|
|
}
|
|
|
|
// SubmitAnswerInput captures answer submission payload.
|
|
type SubmitAnswerInput struct {
|
|
SessionID string
|
|
Answer string
|
|
}
|
|
|
|
// RequestHintInput captures hint request payload.
|
|
type RequestHintInput struct {
|
|
SessionID string
|
|
}
|
|
|
|
// SessionQuestion is the normalized question payload from question-bank.
|
|
type SessionQuestion struct {
|
|
ID string `json:"id"`
|
|
Theme string `json:"theme"`
|
|
Text string `json:"text"`
|
|
Hint string `json:"hint,omitempty"`
|
|
Difficulty string `json:"difficulty"`
|
|
}
|
|
|
|
// SessionSummary is the canonical session response structure.
|
|
type SessionSummary struct {
|
|
ID string `json:"id"`
|
|
PlayerID string `json:"player_id"`
|
|
PlayerName string `json:"player_name"`
|
|
Status string `json:"status"`
|
|
TotalScore int `json:"total_score"`
|
|
QuestionsAsked int `json:"questions_asked"`
|
|
QuestionsCorrect int `json:"questions_correct"`
|
|
HintsUsed int `json:"hints_used"`
|
|
CurrentQuestionID string `json:"current_question_id,omitempty"`
|
|
CurrentAttempts int `json:"current_attempts"`
|
|
CurrentHintUsed bool `json:"current_hint_used"`
|
|
StartTime time.Time `json:"start_time"`
|
|
EndTime *time.Time `json:"end_time,omitempty"`
|
|
RemainingSeconds int64 `json:"remaining_seconds"`
|
|
}
|
|
|
|
// StartSessionResult is returned for session start endpoint.
|
|
type StartSessionResult struct {
|
|
Session SessionSummary `json:"session"`
|
|
Question SessionQuestion `json:"question"`
|
|
}
|
|
|
|
// SubmitAnswerResult is returned for answer endpoint.
|
|
type SubmitAnswerResult struct {
|
|
Session SessionSummary `json:"session"`
|
|
Correct bool `json:"correct"`
|
|
AwardedScore int `json:"awarded_score"`
|
|
AttemptsRemaining int `json:"attempts_remaining"`
|
|
NextQuestion *SessionQuestion `json:"next_question,omitempty"`
|
|
SessionCompleted bool `json:"session_completed"`
|
|
}
|
|
|
|
// HintResult is returned for hint endpoint.
|
|
type HintResult struct {
|
|
Session SessionSummary `json:"session"`
|
|
Hint string `json:"hint"`
|
|
}
|
|
|
|
// UserProfile is minimal user-service data required for session start.
|
|
type UserProfile struct {
|
|
ID string
|
|
DisplayName string
|
|
EmailVerified bool
|
|
}
|
|
|
|
// AnswerValidationResult is normalized question-bank answer match response.
|
|
type AnswerValidationResult struct {
|
|
Matched bool
|
|
Score float64
|
|
}
|