package models

import (
	"time"

	"gorm.io/datatypes"
)

type Quiz struct {
	ID        string         `json:"id" db:"id" example:"1b066168-68c4-4b50-bc9a-b6c4fceaf378" gorm:"column:id;size:255;primary_key;"`
	ProgramID string         `json:"program_id" db:"program_id" example:"2036023a-fb56-4b6c-b3bb-c787c681ada6" gorm:"column:program_id;size:255;index;"`
	Sequence  int            `json:"sequence" db:"sequence" example:"5" gorm:"column:sequence;index;"`
	QuizType  string         `json:"quiz_type" db:"quiz_type" example:"choice" gorm:"column:quiz_type;size:10;index;"`
	Question  string         `json:"question" db:"question" example:"퀴즈 질문입니다." gorm:"column:question;size:512;"`
	Choice    datatypes.JSON `json:"choice" db:"choice" gorm:"column:choice;"`
	Answer    datatypes.JSON `json:"answer" db:"answer" gorm:"column:answer;"`
	Hint      string         `json:"hint" db:"hint" example:"퀴즈 힌트" gorm:"column:answer;size:1024;"`
	Comment   string         `json:"comment" db:"comment" example:"퀴즈 해설" gorm:"column:comment;size:1024;"`
	UpdatedAt time.Time      `json:"-" gorm:"column:updated_at;index;"`
	CreatedAt time.Time      `json:"-" gorm:"column:created_at;index;"`
}

type QuizRequest struct {
	ProgramID string         `json:"program_id"`
	Sequence  int            `json:"sequence"`
	QuizType  string         `json:"quiz_type"`
	Question  string         `json:"question"`
	Choice    datatypes.JSON `json:"choice"`
	Answer    datatypes.JSON `json:"answer"`
	Hint      string         `json:"hint"`
	Comment   string         `json:"comment"`
}

type QuizResponse struct {
	ID        string         `json:"id" example:"1b066168-68c4-4b50-bc9a-b6c4fceaf378"`
	ProgramID string         `json:"program_id" example:"2036023a-fb56-4b6c-b3bb-c787c681ada6"`
	Sequence  int            `json:"sequence" example:"5" gorm:"column:sequence;index;"`
	QuizType  string         `json:"quiz_type" example:"check"`
	Question  string         `json:"question" example:"퀴즈 질문입니다."`
	Choice    datatypes.JSON `json:"choice"`
	Answer    datatypes.JSON `json:"answer"`
	Hint      string         `json:"hint" example:"퀴즈 힌트"`
	Comment   string         `json:"comment" example:"퀴즈 해설"`
}

type QuizListResponse struct {
	Data      []Quiz `json:"data"`
	Total     int64  `json:"total" example:"5"`
	Page      int    `json:"page" example:"1"`
	TotalPage int64  `json:"totalPage" example:"1"`
	PageSize  int    `json:"pageSize" example:"10"`
}
