package cn.iocoder.yudao.module.system.controller.admin.attendance.vo;

import cn.hutool.core.date.BetweenFormatter;
import cn.hutool.core.date.DateUtil;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.List;

@Data
@Accessors(chain = true)
public class TeamAttendanceStatisticsByCycleVO {

    @Schema(description = "平均工作时间")
    private List<TeamAttendancePunchStatisticsVO> averageWorkingHoursList;

    @Schema(description = "迟到")
    private List<TeamAttendancePunchStatisticsVO> beLateList;

    @Schema(description = "早退")
    private List<TeamAttendancePunchStatisticsVO> leaveEarlyList;

    @Schema(description = "缺卡")
    private List<TeamAttendancePunchStatisticsVO> missingCardList;

    @Schema(description = "旷工")
    private List<TeamAttendancePunchStatisticsVO> absenteeismList;

    @Schema(description = "外勤")
    private List<TeamAttendancePunchStatisticsVO> fieldServiceList;

    @Schema(description = "请假")
    private List<TeamAttendancePunchStatisticsVO> leaveList;

    @Schema(description = "顶部")
    private TeamAttendanceStatisticsNumVO teamAttendanceStatisticsNumVO;


    @Data
    @Accessors(chain = true)
    public static class TeamAttendanceStatisticsNumVO {
        @Schema(description = "平均工时")
        private Long averageWorkingHours;

        @Schema(description = "平均工时中文")
        private String averageWorkingHourStr;

        @Schema(description = "迟到次数")
        private Integer beLateNum;

        @Schema(description = "早退次数")
        private Integer leaveEarlyNum;

        @Schema(description = "缺卡次数")
        private Integer missingCardNum;

        @Schema(description = "请假次数")
        private Integer leaveNum;

        @Schema(description = "旷工次数")
        private Integer absenteeismNum;

        @Schema(description = "外勤次数")
        private Integer fieldServiceNum;


        public void setAverageWorkingHours(Long averageWorkingHours) {
            this.averageWorkingHours = averageWorkingHours;
            this.averageWorkingHourStr = DateUtil.formatBetween(averageWorkingHours, BetweenFormatter.Level.MINUTE);
        }

    }
}
