package com.hdkj.fhzg.optimization.response;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
 * @author rj
 * @date 2026/5/22 17:26
 * @description
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class FeederGroupMetrics {

    //运行问题
    private OperationIssue operationIssue;

    //时户数影响
    private Reliability reliability;

    //网损影响
    private NetworkLossImpact networkLossImpact;

    //网架结构问题
    private NetworkStructureIssue networkStructureIssue;

    /**
     * 运行问题
     */
    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public static class OperationIssue {

        //运行问题分数
        private BigDecimal operationIssueScore;

        //重过载线路数
        private Integer overloadLineCount;

        //区域平均负载率
        private Double avgLoadRate;

        //电压越限节点数
        private Integer voltageViolationNodeCount;

        //整站N-1不通过数量
        private Integer stationN1FailCount;

        //馈线N-1不通过数量
        private Integer feederN1FailCount;

        //线路N-1通过率
        private Double lineN1PassRate;
    }

    /**
     * 可靠性
     */
    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public static class Reliability {

        //可靠性得分
        private BigDecimal reliabilityScore;

        //理论可靠性
        private BigDecimal theoreticalReliability;

        //停电线路数
        private Double outageLineCount;

        //停电配变数
        private Double outageTransformerCount;

        //影响低压用户总数
        private Double affectedLowVoltageUserCount;

        //重要/敏感用户失电数
        private Double importantSensitiveUserLossCount;
    }

    /**
     * 网损影响
     */
    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public static class NetworkLossImpact {

        //网损影响得分
        private BigDecimal networkLossImpactScore;
        //总网损
        private Double totalNetworkLoss;

        //网损不达标数量
        private Double networkLossNonCompliantCount;

        //网损达标率
        private Double networkLossCompliantRate;

        //功率因数不达标线路数
        private Double powerFactorNonCompliantLineCount;
    }

    /**
     * 网架结构问题
     */
    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public static class NetworkStructureIssue {

        //网架结构问题得分
        private BigDecimal networkStructureIssueScore;
        //单辐射线路数
        private Double singleRadiationLineCount;

        //线路联络率
        private Double lineContactRate;

        //复杂联络线路数
        private Double complexContactLineCount;

        //供电半径超标线路数
        private Double powerRadiusExceedLineCount;

        //大分支数量
        private Double largeBranchCount;

        //负荷组分段数不合理线路数
        private Double unreasonableSegmentCount;

        //负荷组用户数或容量异常
        private Double abnormalLoadGroupCount;

        //整线装机容量过大
        private Double excessiveInstalledCapacityCount;

        //整线挂接用户超80
        private Double userExceed80Count;
    }
}
