package top.tqx.demo_1.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.databind.JsonNode;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@TableName(value = "user_answer", autoResultMap = true)
public class UserAnswer implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    private Long userId;

    @TableField(value = "question_id")
    private String questionId;

    @TableField(value = "question_type")
    private String questionType;

    @TableField(value = "answer_type")
    private String answerType;

    @TableField(value = "paper_id")
    private String paperId;

    @TableField(value = "session_id")
    private String sessionId;

    @TableField(value = "user_answer", typeHandler = JacksonTypeHandler.class)
    private JsonNode userAnswer;

    private BigDecimal score;

    @TableField(value = "max_score")
    private BigDecimal maxScore;

    @TableField(value = "is_correct")
    private Integer isCorrect;

    @TableField(value = "grading_type")
    private String gradingType;

    private String feedback;

    @TableField(value = "time_spent")
    private Integer timeSpent;

    @TableField(value = "paper_time_spent")
    private Integer paperTimeSpent;

    @TableField(value = "created_at")
    private LocalDateTime createdAt;

    @TableField(value = "updated_at")
    private LocalDateTime updatedAt;
}
