package scoring

import (
	"encoding/json"
	"time"

	"github.com/google/uuid"
)

type Question struct {
	ID            uuid.UUID       `json:"id"`
	TestTypeID    uuid.UUID       `json:"test_type_id"`
	QuestionType  string          `json:"question_type"`
	OrderNumber   int             `json:"order_number"`
	AnswerKey     json.RawMessage `json:"answer_key"`
	ScoringWeight float64         `json:"scoring_weight"`
	Items         json.RawMessage `json:"items"`
}

type CandidateAnswer struct {
	ID          uuid.UUID       `json:"id"`
	SessionID   uuid.UUID       `json:"session_id"`
	CandidateID uuid.UUID       `json:"candidate_id"`
	QuestionID  uuid.UUID       `json:"question_id"`
	Answer      json.RawMessage `json:"answer"`
}

type ScoringRule struct {
	ID         uuid.UUID       `json:"id"`
	TestTypeID uuid.UUID       `json:"test_type_id"`
	Rules      json.RawMessage `json:"rules"`
}

type CandidateResult struct {
	ID              uuid.UUID       `json:"id"`
	SessionID       uuid.UUID       `json:"session_id"`
	CandidateID     uuid.UUID       `json:"candidate_id"`
	TestTypeID      uuid.UUID       `json:"test_type_id"`
	TotalScore      float64         `json:"total_score"`
	NormalizedScore *float64        `json:"normalized_score"`
	Result          json.RawMessage `json:"result"`
	Interpretation  *string         `json:"interpretation"`
	CreatedAt       time.Time       `json:"created_at"`
}

type ScoringDataRow struct {
	CandidateID   uuid.UUID
	TestTypeID    uuid.UUID
	QuestionID    uuid.UUID
	QuestionType  string
	OrderNumber   int
	AnswerKey     []byte
	ScoringWeight float64
	ItemsJSON     []byte
	Answer        []byte
}
