package com.erp.inventory.dto;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.Builder;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * 库存预警统计DTO
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class StockWarningStatsDTO {

    /**
     * 统计时间范围开始
     */
    private LocalDateTime startDate;

    /**
     * 统计时间范围结束
     */
    private LocalDateTime endDate;

    /**
     * 总预警数
     */
    private Integer totalWarnings;

    /**
     * 待处理预警数
     */
    private Integer pendingWarnings;

    /**
     * 已解决预警数
     */
    private Integer resolvedWarnings;

    /**
     * 已忽略预警数
     */
    private Integer ignoredWarnings;

    /**
     * 紧急预警数
     */
    private Integer criticalWarnings;

    /**
     * 警告预警数
     */
    private Integer warningWarnings;

    /**
     * 通知预警数
     */
    private Integer infoWarnings;

    /**
     * 低库存预警数
     */
    private Integer lowStockWarnings;

    /**
     * 高库存预警数
     */
    private Integer highStockWarnings;

    /**
     * 缺货预警数
     */
    private Integer outOfStockWarnings;

    /**
     * 预警解决率
     */
    private Double resolveRate;

    /**
     * 平均解决时长（分钟）
     */
    private Double avgResolveTimeMinutes;

    /**
     * 按日期统计的预警数量
     */
    private List<DailyWarningCount> dailyStats;

    /**
     * 按仓库统计的预警数量
     */
    private List<WarehouseWarningCount> warehouseStats;

    /**
     * 按SKU统计的预警数量
     */
    private List<SkuWarningCount> skuStats;

    /**
     * 日统计
     */
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Builder
    public static class DailyWarningCount {
        private String date;
        private Integer count;
        private Integer resolved;
    }

    /**
     * 仓库预警统计
     */
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Builder
    public static class WarehouseWarningCount {
        private Long warehouseId;
        private String warehouseName;
        private Integer count;
        private Integer pending;
    }

    /**
     * SKU预警统计
     */
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Builder
    public static class SkuWarningCount {
        private String skuCode;
        private String skuName;
        private Integer count;
        private Integer pending;
    }
}
