package domain

import "time"

type QuestionType string

const (
	QuestionTypeMCQ         QuestionType = "MCQ"
	QuestionTypeTrueFalse   QuestionType = "TRUE_FALSE"
	QuestionTypeShortAnswer QuestionType = "SHORT_ANSWER"
)

type DifficultyLevel string

const (
	DifficultyEasy   DifficultyLevel = "EASY"
	DifficultyMedium DifficultyLevel = "MEDIUM"
	DifficultyHard   DifficultyLevel = "HARD"
)

type QuestionSetType string

const (
	QuestionSetTypePractice          QuestionSetType = "PRACTICE"
	QuestionSetTypeInitialAssessment QuestionSetType = "INITIAL_ASSESSMENT"
	QuestionSetTypeQuiz              QuestionSetType = "QUIZ"
	QuestionSetTypeExam              QuestionSetType = "EXAM"
	QuestionSetTypeSurvey            QuestionSetType = "SURVEY"
)

type MatchType string

const (
	MatchTypeExact           MatchType = "EXACT"
	MatchTypeContains        MatchType = "CONTAINS"
	MatchTypeCaseInsensitive MatchType = "CASE_INSENSITIVE"
)

type Question struct {
	ID                      int64
	QuestionText            string
	QuestionType            string
	DifficultyLevel         *string
	Points                  int32
	Explanation             *string
	Tips                    *string
	VoicePrompt             *string
	SampleAnswerVoicePrompt *string
	Status                  string
	CreatedAt               time.Time
	UpdatedAt               *time.Time
}

type QuestionWithDetails struct {
	Question
	Options      []QuestionOption
	ShortAnswers []QuestionShortAnswer
}

type QuestionOption struct {
	ID          int64
	QuestionID  int64
	OptionText  string
	OptionOrder int32
	IsCorrect   bool
	CreatedAt   time.Time
}

type QuestionShortAnswer struct {
	ID               int64
	QuestionID       int64
	AcceptableAnswer string
	MatchType        string
	CreatedAt        time.Time
}

type QuestionSet struct {
	ID               int64
	Title            string
	Description      *string
	SetType          string
	OwnerType        *string
	OwnerID          *int64
	BannerImage      *string
	Persona          *string
	TimeLimitMinutes *int32
	PassingScore     *int32
	ShuffleQuestions bool
	Status           string
	SubCourseVideoID *int64
	UserPersonas     []UserPersona
	CreatedAt        time.Time
	UpdatedAt        *time.Time
}

type QuestionSetItem struct {
	ID           int64
	SetID        int64
	QuestionID   int64
	DisplayOrder int32
	CreatedAt    time.Time
}

type QuestionSetItemWithQuestion struct {
	QuestionSetItem
	QuestionText    string
	QuestionType    string
	DifficultyLevel *string
	Points          int32
	Explanation     *string
	Tips            *string
	VoicePrompt     *string
	QuestionStatus  string
}

type CreateQuestionInput struct {
	QuestionText            string
	QuestionType            string
	DifficultyLevel         *string
	Points                  *int32
	Explanation             *string
	Tips                    *string
	VoicePrompt             *string
	SampleAnswerVoicePrompt *string
	Status                  *string
	Options                 []CreateQuestionOptionInput
	ShortAnswers            []CreateShortAnswerInput
}

type CreateQuestionOptionInput struct {
	OptionText  string
	OptionOrder *int32
	IsCorrect   bool
}

type CreateShortAnswerInput struct {
	AcceptableAnswer string
	MatchType        *string
}

type CreateQuestionSetInput struct {
	Title            string
	Description      *string
	SetType          string
	OwnerType        *string
	OwnerID          *int64
	BannerImage      *string
	Persona          *string
	TimeLimitMinutes *int32
	PassingScore     *int32
	ShuffleQuestions *bool
	Status           *string
	SubCourseVideoID *int64
}

// UserPersona represents a user acting as a persona in a practice session
type UserPersona struct {
	ID                int64
	FirstName         *string
	LastName          *string
	NickName          *string
	ProfilePictureURL *string
	Role              string
	DisplayOrder      int32
}
