package com.sundot.airport.exam.dto;

import java.io.Serializable;

/**
 * <b>功能名：</b>DashboardUserRankingDTO<br>
 * <b>说明：</b> 个人任务完成排行榜DTO <br>
 * <b>著作权：</b> Copyright (C) 2025 SUNDOT CORPORATION<br>
 * <b>修改履历：
 *
 * @author 2025-01-19
 */
public class DashboardUserRankingDTO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 用户姓名
     */
    private String userName;

    /**
     * 部门名称
     */
    private String deptName;

    /**
     * 角色名称
     */
    private String roleName;

    /**
     * 总任务数
     */
    private Long totalTasks;

    /**
     * 已完成任务数
     */
    private Long completedTasks;

    /**
     * 完成率(%)
     */
    private Double completionRate;

    /**
     * 平均得分
     */
    private Double avgScore;

    /**
     * 正确率(%)
     */
    private Double accuracyRate;

    /**
     * 逾期任务数
     */
    private Long expiredTasks;

    /**
     * 排名
     */
    private Integer rank;

    /**
     * 奖牌类型: gold/silver/bronze
     */
    private String medal;

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    public Long getTotalTasks() {
        return totalTasks;
    }

    public void setTotalTasks(Long totalTasks) {
        this.totalTasks = totalTasks;
    }

    public Long getCompletedTasks() {
        return completedTasks;
    }

    public void setCompletedTasks(Long completedTasks) {
        this.completedTasks = completedTasks;
    }

    public Double getCompletionRate() {
        return completionRate;
    }

    public void setCompletionRate(Double completionRate) {
        this.completionRate = completionRate;
    }

    public Double getAvgScore() {
        return avgScore;
    }

    public void setAvgScore(Double avgScore) {
        this.avgScore = avgScore;
    }

    public Double getAccuracyRate() {
        return accuracyRate;
    }

    public void setAccuracyRate(Double accuracyRate) {
        this.accuracyRate = accuracyRate;
    }

    public Long getExpiredTasks() {
        return expiredTasks;
    }

    public void setExpiredTasks(Long expiredTasks) {
        this.expiredTasks = expiredTasks;
    }

    public Integer getRank() {
        return rank;
    }

    public void setRank(Integer rank) {
        this.rank = rank;
        // 自动设置奖牌
        if (rank != null) {
            if (rank == 1) {
                this.medal = "gold";
            } else if (rank == 2) {
                this.medal = "silver";
            } else if (rank == 3) {
                this.medal = "bronze";
            }
        }
    }

    public String getMedal() {
        return medal;
    }

    public void setMedal(String medal) {
        this.medal = medal;
    }

    @Override
    public String toString() {
        return "DashboardUserRankingDTO{" +
                "userId=" + userId +
                ", userName='" + userName + '\'' +
                ", deptName='" + deptName + '\'' +
                ", roleName='" + roleName + '\'' +
                ", totalTasks=" + totalTasks +
                ", completedTasks=" + completedTasks +
                ", completionRate=" + completionRate +
                ", avgScore=" + avgScore +
                ", accuracyRate=" + accuracyRate +
                ", expiredTasks=" + expiredTasks +
                ", rank=" + rank +
                ", medal='" + medal + '\'' +
                '}';
    }
}
