package com.njcn.pojo.data;

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

public class LimitrateDays implements Comparable<LimitrateDays> {
    private String name;
    private List<Result> list;
    private String index;

    public String getIndex() {
        return index;
    }

    public void setIndex(String index) {
        this.index = index;
    }

    public LimitrateDays() {
        this.list = new ArrayList<>();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<Result> getList() {
        return list;
    }

    public void setList(List<Result> list) {
        this.list = list;
    }

    @Override
    public int compareTo(LimitrateDays o) {
        int result=0;
        String thisName=this.getName();
        String oName=o.getName();
        try {
            float thisFloat=Float.valueOf(thisName.substring(0,thisName.indexOf("kV")));
            float oFloat=Float.valueOf(oName.substring(0,oName.indexOf("kV")));
            if(thisFloat>oFloat){
                result = 1;
            }else if(thisFloat<oFloat){
                result = -1;
            }
        }catch (Exception e){
            return result;
        }
        return result;
    }

    public class Result {
        private Integer day;
        private Integer year; //年份
        private Integer month; //月份
        private Float target;
        private Integer total = null; //分片查询时汇总的分母
        private Integer data = 0; //分片查询时汇总的分子

        public Integer getYear() {
            return year;
        }

        public void setYear(Integer year) {
            this.year = year;
        }

        public Integer getMonth() {
            return month;
        }

        public void setMonth(Integer month) {
            this.month = month;
        }

        public Integer getTotal() {
            return total;
        }

        public void setTotal(Integer total) {
            this.total = total;
        }

        public Integer getData() {
            return data;
        }

        public void setData(Integer data) {
            this.data = data;
        }

        public Integer getDay() {
            return day;
        }

        public void setDay(Integer day) {
            this.day = day;
        }

        public Float getTarget() {
            return target;
        }

        public void setTarget(Float target) {
            this.target = target;
        }
    }
}
