package com.hdkj.lt.modle.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
 * 运行指标 (metrics, 1:1, metrics_before/after 扁平 + delta/judgement 用JSON)
 * health.weights / health.components 同构固定键, 一并扁平
 * 对应表: fhzg_recon_metrics
 */
@Data
@NoArgsConstructor
@TableName("fhzg_recon_metrics")
public class FhzgReconMetrics {

    @TableId(type = IdType.AUTO)
    private Long id;

    /** 主表ID */
    private Long resultId;

    // ---- loading 线路负载 ----
    private Integer beforeLoadingLineCount;
    private Integer beforeLoadingExtGridCount;
    private BigDecimal beforeLoadingMaxLoadingPct;
    private BigDecimal beforeLoadingAvgLoadingPct;
    private Integer beforeLoadingOverLimitCount;
    private BigDecimal beforeLoadingLoadingLimitPct;
    private String beforeLoadingUnit;
    private String beforeLoadingLoadingSource;
    private BigDecimal beforeLoadingLineMaxLoadingPct;
    private BigDecimal beforeLoadingLineAvgLoadingPct;
    private Integer beforeLoadingLineOverLimitCount;

    private Integer afterLoadingLineCount;
    private Integer afterLoadingExtGridCount;
    private BigDecimal afterLoadingMaxLoadingPct;
    private BigDecimal afterLoadingAvgLoadingPct;
    private Integer afterLoadingOverLimitCount;
    private BigDecimal afterLoadingLoadingLimitPct;
    private String afterLoadingUnit;
    private String afterLoadingLoadingSource;
    private BigDecimal afterLoadingLineMaxLoadingPct;
    private BigDecimal afterLoadingLineAvgLoadingPct;
    private Integer afterLoadingLineOverLimitCount;

    // ---- loss 损耗 ----
    private BigDecimal beforeLossLineLossMw;
    private BigDecimal beforeLossTrafoLossMw;
    private BigDecimal beforeLossTotalLossMw;
    private String beforeLossUnit;

    private BigDecimal afterLossLineLossMw;
    private BigDecimal afterLossTrafoLossMw;
    private BigDecimal afterLossTotalLossMw;
    private String afterLossUnit;

    // ---- voltage 电压 ----
    private BigDecimal beforeVoltageMinVmPu;
    private BigDecimal beforeVoltageMaxVmPu;
    private BigDecimal beforeVoltageAvgVmPu;
    private Integer beforeVoltageUnderVminCount;
    private Integer beforeVoltageOverVmaxCount;
    private BigDecimal beforeVoltageVminPu;
    private BigDecimal beforeVoltageVmaxPu;
    private Integer beforeVoltageBusCount;
    private String beforeVoltageUnit;

    private BigDecimal afterVoltageMinVmPu;
    private BigDecimal afterVoltageMaxVmPu;
    private BigDecimal afterVoltageAvgVmPu;
    private Integer afterVoltageUnderVminCount;
    private Integer afterVoltageOverVmaxCount;
    private BigDecimal afterVoltageVminPu;
    private BigDecimal afterVoltageVmaxPu;
    private Integer afterVoltageBusCount;
    private String afterVoltageUnit;

    // ---- reliability 可靠性(预留) ----
    private Boolean beforeReliabilityEnabled;
    private String beforeReliabilityComment;
    private Boolean afterReliabilityEnabled;
    private String afterReliabilityComment;

    // ---- health 健康度 (score/base/penalty + weights[5] + components[5]) ----
    private BigDecimal beforeHealthScore;
    private BigDecimal beforeHealthBase;
    private BigDecimal beforeHealthPenalty;
    private BigDecimal beforeHealthWeightSafe;
    private BigDecimal beforeHealthWeightVoltage;
    private BigDecimal beforeHealthWeightLoss;
    private BigDecimal beforeHealthWeightBalance;
    private BigDecimal beforeHealthWeightRisk;
    private BigDecimal beforeHealthComponentSafe;
    private BigDecimal beforeHealthComponentVoltage;
    private BigDecimal beforeHealthComponentLoss;
    private BigDecimal beforeHealthComponentBalance;
    private BigDecimal beforeHealthComponentRisk;

    private BigDecimal afterHealthScore;
    private BigDecimal afterHealthBase;
    private BigDecimal afterHealthPenalty;
    private BigDecimal afterHealthWeightSafe;
    private BigDecimal afterHealthWeightVoltage;
    private BigDecimal afterHealthWeightLoss;
    private BigDecimal afterHealthWeightBalance;
    private BigDecimal afterHealthWeightRisk;
    private BigDecimal afterHealthComponentSafe;
    private BigDecimal afterHealthComponentVoltage;
    private BigDecimal afterHealthComponentLoss;
    private BigDecimal afterHealthComponentBalance;
    private BigDecimal afterHealthComponentRisk;

    // ---- 动态键/差值/评判 用 JSON ----
    /** 重构前各馈线负载率(键为馈线ID) */
    private String beforeFeederLoadRatesPct;

    /** 重构后各馈线负载率(键为馈线ID) */
    private String afterFeederLoadRatesPct;

    /** 指标差值对比(delta 整块) */
    private String delta;

    /** 智能评判(judgement 整块) */
    private String judgement;
}