package org.springblade.modules.nh.factory.goodwe.dto.getInventersdatas;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.util.Date;

@Data
public class GetInventersDatasRd {

    /**
     * 数据最新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date creationDate;
    /**
     * 今日发电量
     */
    @JsonProperty("eDay")
    private Double eDay;
    /**
     * 累计发电量
     */
    @JsonProperty("eTotal")
    private Double eTotal;
    /**
     * 发电功率
     */
    @JsonProperty("pac")
    private Double pac;
    /**
     * 累计发电小时
     */
    @JsonProperty("hTotal")
    private Double hTotal;

    private Double vpv1;
    private Double vpv2;
    /**
     * 直流电压 3
     */
    private Double vpv3;
    private Double vpv4;
    private Double vpv5;
    private Double vpv6;
    private Double vpv7;
    private Double vpv8;
    private Double vpv9;
    private Double vpv10;
    private Double vpv11;
    private Double vpv12;

    private Double ipv1;
    private Double ipv2;
    /**
     * 直流电流 3
     */
    private Double ipv3;
    private Double ipv4;
    private Double ipv5;
    private Double ipv6;
    private Double ipv7;
    private Double ipv8;
    private Double ipv9;
    private Double ipv10;
    private Double ipv11;
    private Double ipv12;

    public Double calcDC() {
        return calc(ipv1, vpv1)
                + calc(ipv2, vpv2)
                + calc(ipv3, vpv3)
                + calc(ipv4, vpv4)
                + calc(ipv5, vpv5)
                + calc(ipv6, vpv6)
                + calc(ipv7, vpv7)
                + calc(ipv8, vpv8)
                + calc(ipv9, vpv9)
                + calc(ipv10, vpv10)
                + calc(ipv11, vpv11)
                + calc(ipv12, vpv12);
    }

    private double calc(Double i, Double v) {
        if (i != null && v != null) {
            return i * v;
        }
        return 0d;
    }

}
