package com.yuchen.saas.park.api.vo.device;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @Author: 肖润飞
 * @CreateTime: 2022/09/07 18:03
 * @Description: 设备属性计算基础类
 * @Version: 1.0
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class DeviceProBaseCount /* extends DeviceBasePro */ {

    /**
     * 计算属性值集合
     */
    private CountData countData;

    /**
     * 趋势数据
     */
    @JsonIgnore
    private TrendData trendData;
    /**
     * 将趋势数据转成list
     */
    private List<Float> trendDataList;

    /**
     * 排名数据
     */
    private List<RankData> rankData;

    /**
     * 最新数据,用于计算 key= deviceName value=走表数据
     */
    @JsonIgnore
    private Map<Object,Object> latestData;

    public List<Float> getTrendDataList() {
        trendDataList = new ArrayList<>();
        if (this.getTrendData() != null) {
            trendDataList.add(Double.valueOf(this.getTrendData().getToday6()).floatValue());
            trendDataList.add(Double.valueOf(this.getTrendData().getToday5()).floatValue());
            trendDataList.add(Double.valueOf(this.getTrendData().getToday4()).floatValue());
            trendDataList.add(Double.valueOf(this.getTrendData().getToday3()).floatValue());
            trendDataList.add(Double.valueOf(this.getTrendData().getToday2()).floatValue());
            trendDataList.add(Double.valueOf(this.getTrendData().getToday1()).floatValue());
            trendDataList.add(Double.valueOf(this.getTrendData().getToday0()).floatValue());
        }
        return trendDataList;
    }
}