package com.fizz.business.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * 设备图表数据 DTO
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "设备图表数据")
public class DeviceChartDataDTO implements Serializable {
    private static final long serialVersionUID = 1L;

    @Schema(description = "设备类型分布饼图数据")
    private PieChartData deviceTypePieChart;

    @Schema(description = "数据来源分布条形图数据")
    private BarChartData sourceTypeBarChart;

    @Schema(description = "同类型设备对比折线图数据（单位相同）")
    private LineChartData sameTypeDeviceCompareChart;

    @Schema(description = "设备统计数据")
    private List<DeviceStatistics> deviceStatistics;

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @Schema(description = "饼图数据")
    public static class PieChartData implements Serializable {
        private static final long serialVersionUID = 1L;

        @Schema(description = "数据系列")
        private List<PieSeries> series;
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @Schema(description = "饼图系列")
    public static class PieSeries implements Serializable {
        private static final long serialVersionUID = 1L;

        @Schema(description = "名称")
        private String name;

        @Schema(description = "数值")
        private Double data;

        @Schema(description = "颜色")
        private String color;
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @Schema(description = "条形图数据")
    public static class BarChartData implements Serializable {
        private static final long serialVersionUID = 1L;

        @Schema(description = "分类轴")
        private List<String> categories;

        @Schema(description = "数据系列")
        private List<BarSeries> series;
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @Schema(description = "条形图系列")
    public static class BarSeries implements Serializable {
        private static final long serialVersionUID = 1L;

        @Schema(description = "系列名称")
        private String name;

        @Schema(description = "数据值列表")
        private List<Double> data;
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @Schema(description = "折线图数据")
    public static class LineChartData implements Serializable {
        private static final long serialVersionUID = 1L;

        @Schema(description = "时间轴")
        private List<String> categories;

        @Schema(description = "数据系列")
        private List<LineSeries> series;
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @Schema(description = "折线图系列")
    public static class LineSeries implements Serializable {
        private static final long serialVersionUID = 1L;

        @Schema(description = "系列名称")
        private String name;

        @Schema(description = "数据值列表")
        private List<Double> data;
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @Schema(description = "设备统计数据")
    public static class DeviceStatistics implements Serializable {
        private static final long serialVersionUID = 1L;

        @Schema(description = "设备代码")
        private String deviceCode;

        @Schema(description = "设备名称")
        private String deviceName;

        @Schema(description = "平均值")
        private String avg;

        @Schema(description = "最大值")
        private String max;

        @Schema(description = "最小值")
        private String min;

        @Schema(description = "当前值")
        private String current;
    }
}

