package com.usky.vpp.service.vo;

import lombok.Data;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * 运行管理监控大屏 - 汇总 KPI
 */
@Data
public class DashboardSummaryVO {

    private Access access = new Access();
    private Basic basic = new Basic();
    private DeviceStatus deviceStatus = new DeviceStatus();
    private Subsidy subsidy = new Subsidy();
    private YearRegulation yearRegulation = new YearRegulation();
    private SocialBenefit socialBenefit = new SocialBenefit();
    private List<EarningsRankItem> earningsRank = new ArrayList<>();

    @Data
    public static class Access {
        /** 接入站点数 */
        private Long siteCount = 0L;
        /** 接入装机容量 kW */
        private BigDecimal totalCapacityKw = BigDecimal.ZERO;
        /** 接入光伏 kW */
        private BigDecimal pvCapacityKw = BigDecimal.ZERO;
        /** 接入储能资源 kW */
        private BigDecimal essCapacityKw = BigDecimal.ZERO;
        /** 接入可调资源 kW */
        private BigDecimal adjustableCapacityKw = BigDecimal.ZERO;
    }

    @Data
    public static class Basic {
        /** 接入用户数量 */
        private Long customerCount = 0L;
        /** 负荷容量 kW（负荷类资源） */
        private BigDecimal loadCapacityKw = BigDecimal.ZERO;
        /** 可调设备数量 */
        private Long adjustableDeviceCount = 0L;
        /** 累计削峰量 kW（仅已结束事件） */
        private BigDecimal peakShaveTotalKw = BigDecimal.ZERO;
        /** 累计填谷量 kW（仅已结束事件） */
        private BigDecimal valleyFillTotalKw = BigDecimal.ZERO;
        /** 最大上调功率 kW */
        private BigDecimal maxUpKw = BigDecimal.ZERO;
        /** 最大下调功率 kW */
        private BigDecimal maxDownKw = BigDecimal.ZERO;
    }

    @Data
    public static class DeviceStatus {
        /** 设备总数 */
        private Long total = 0L;
        /** 在线设备数 */
        private Long online = 0L;
        /** 离线设备数 */
        private Long offline = 0L;
        /** 故障设备数 */
        private Long fault = 0L;
    }

    @Data
    public static class Subsidy {
        /** 累计补贴总额（元，仅已结束事件评价） */
        private BigDecimal totalAmount = BigDecimal.ZERO;
    }

    @Data
    public static class YearRegulation {
        /** 年份 */
        private Integer year;
        /** 执行偏差率 0~1 */
        private BigDecimal executionDeviationRate;
        /** 响应完成率 0~1 */
        private BigDecimal responseCompletionRate;
        /** 有效调控容量 MW */
        private BigDecimal effectiveCapacityMw = BigDecimal.ZERO;
        /** 总调控容量 MW */
        private BigDecimal totalCapacityMw = BigDecimal.ZERO;
        /** 总调控时长 H */
        private BigDecimal totalDurationHour = BigDecimal.ZERO;
        /** 总邀约次数 */
        private Long invitationCount = 0L;
        /** 总参与次数 */
        private Long participationCount = 0L;
    }

    @Data
    public static class SocialBenefit {
        /** 减碳量（吨） */
        private BigDecimal carbonReductionTon = BigDecimal.ZERO;
        /** 节约标准煤（吨） */
        private BigDecimal coalSavedTon = BigDecimal.ZERO;
        /** 等效植树量（棵） */
        private Long equivalentTrees = 0L;
        /** 等效绿证数（张） */
        private Long equivalentGreenCert = 0L;
    }

    @Data
    public static class EarningsRankItem {
        private Long siteId;
        private String siteName;
        /** 收益（元） */
        private BigDecimal earnings = BigDecimal.ZERO;
    }
}
