package com.ycwl.basic.integration.questionnaire.dto.statistics;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.util.List;
import java.util.Map;

@Data
public class QuestionnaireStatistics {
    
    @JsonProperty("totalResponses")
    private Integer totalResponses;
    
    @JsonProperty("completionRate")
    private Double completionRate;
    
    @JsonProperty("averageTime")
    private Integer averageTime; // 平均答题时间（秒）
    
    @JsonProperty("questionStats")
    private List<QuestionStatistics> questionStats;
    
    @JsonProperty("responsesByDate")
    private Map<String, Integer> responsesByDate;
    
    @JsonProperty("createdAt")
    private String createdAt;
    
    @JsonProperty("updatedAt")
    private String updatedAt;
}

@Data
class QuestionStatistics {
    
    @JsonProperty("questionId")
    private Long questionId;
    
    @JsonProperty("questionTitle")
    private String questionTitle;
    
    @JsonProperty("questionType")
    private Integer questionType;
    
    @JsonProperty("totalAnswers")
    private Integer totalAnswers;
    
    @JsonProperty("optionStats")
    private List<OptionStatistics> optionStats;
    
    @JsonProperty("textAnswers")
    private List<String> textAnswers; // 用于填空题和文本域题
}

@Data
class OptionStatistics {
    
    @JsonProperty("optionId")
    private Long optionId;
    
    @JsonProperty("optionText")
    private String optionText;
    
    @JsonProperty("optionValue")
    private String optionValue;
    
    @JsonProperty("count")
    private Integer count;
    
    @JsonProperty("percentage")
    private Double percentage;
}