package org.dromara.elevator.domain.vo;

import lombok.Data;

import java.math.BigDecimal;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

/**
 * 大屏-救援时间占比
 * @author ym
 * @version 1.0.0
 * @date 2024-12-05 12:52
 */
@Data
public class ELargeScreenRescueTimeStatisticsVo {

    /**
     * 接收时间占比
     */
    private List<ReceiveTimeInfo> receiveTimeList;

    /**
     * 接收时间占比
     */
    private List<RescueTimeInfo> rescueTimeList;

    /**
     * 接收时间信息
     */
    @Data
    public static class ReceiveTimeInfo {

        /**
         * 接收时间占比类型
         * 0: <15分钟
         * 1: 15~30分钟
         * 2: >30分钟
         */
        private Integer timeType;

        /**
         * 比例
         */
        private BigDecimal ratio;

        /**
         * 次数
         */
        private Integer num;

        public ReceiveTimeInfo() {
        }

        public ReceiveTimeInfo(Integer timeType) {
            this.timeType = timeType;
            this.ratio = BigDecimal.ZERO;
            this.num = 0;
        }
    }

    /**
     * 救援时间信息
     */
    @Data
    public static class RescueTimeInfo {

        /**
         * 救援时间占比类型
         * 0: <30分钟
         * 1: 30分钟~2小时
         * 2: >2小时
         */
        private Integer timeType;

        /**
         * 比例
         */
        private BigDecimal ratio;

        /**
         * 次数
         */
        private Integer num;

        public RescueTimeInfo() {
        }

        public RescueTimeInfo(Integer timeType) {
            this.timeType = timeType;
            this.ratio = BigDecimal.ZERO;
            this.num = 0;
        }
    }

    public ELargeScreenRescueTimeStatisticsVo() {
        this.receiveTimeList = IntStream.range(0, 3).mapToObj(ReceiveTimeInfo::new).collect(Collectors.toList());
        this.rescueTimeList = IntStream.range(0, 3).mapToObj(RescueTimeInfo::new).collect(Collectors.toList());
    }
}
