package cn.iocoder.yudao.module.train.vo;

import cn.iocoder.yudao.module.train.entity.Train;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;

@Data
public class TrainExportVO {

    @ExcelIgnore
    private String id;

    @ExcelIgnore
    private Long userId;

    @ExcelProperty(value = "学员", index = 0)
    private String userName;

    @ExcelProperty(value = "学员手机号", index = 1)
    private String userMobile;

    @ExcelIgnore
    private Long coachId;

    @ExcelProperty(value = "课程", index = 2)
    private String courseName;

    @ExcelProperty(value = "教练", index = 3)
    private String coachName;

    @ExcelProperty(value = "科目", index = 4)
    private String subjectStr;

    @ExcelIgnore
    private Integer subject;

    public void setSubject(Integer subject) {
        this.subject = subject;
        this.subjectStr = convertSubjectToStr(subject);
    }

    private String convertSubjectToStr(Integer subject) {
        if (subject == null) {
            return "";
        }
        switch (subject) {
            case 1: return "科目一";
            case 2: return "科目二";
            case 3: return "科目三";
            case 4: return "科目四";
            default: return "未知科目";
        }
    }

    @ExcelIgnore
    private String carId;

    @ExcelProperty(value = "车牌号", index = 5)
    private String carNo;

    @ExcelProperty(value = "训练日期", index = 6)
    private String trainDay;

    @ExcelProperty(value = "训练地址", index = 7)
    private String addr;

    @ExcelProperty(value = "到场时间", index = 8)
    private String startTimeStr;

    @ExcelIgnore
    private LocalDateTime startTime;

    public void setStartTime(LocalDateTime startTime) {
        this.startTime = startTime;
        if (startTime != null) {
            this.startTimeStr = startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
        }
    }

    @ExcelProperty(value = "到场备注", index = 9)
    private String startRemark;

    @ExcelProperty(value = "离场时间", index = 10)
    private String endTimeStr;

    @ExcelIgnore
    private LocalDateTime endTime;

    public void setEndTime(LocalDateTime endTime) {
        this.endTime = endTime;
        if (endTime != null) {
            this.endTimeStr = endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
        }
    }

    @ExcelProperty(value = "离场备注", index = 11)
    private String endRemark;

    @ExcelProperty(value = "训练时长（分钟）", index = 12)
    private Double trainTime;


    @ExcelIgnore
    private String trainStartTimeStr;
    @ExcelIgnore
    private String trainEndTimeStr;

    @ExcelIgnore
    private String timeType;

    /**
     * 分页参数
     */
    @ExcelIgnore
    private Integer pageNo = 1;
    @ExcelIgnore
    private Integer pageSize = 10;

    /**
     * 导出类型：all(全部)、current(当前页)、range(自定义范围)
     */
    @ExcelIgnore
    private String exportType;

    /**
     * 自定义范围参数
     */
    @ExcelIgnore
    private Integer startPage;
    @ExcelIgnore
    private Integer endPage;


}
