package cd.casic.ci.process.dto.resp.dataAnalysis;

import cd.casic.ci.process.enums.MachineSystemEnum;
import cd.casic.ci.process.process.dataObject.volumnInfo.VulInfo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Builder;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
import java.util.Random;

/**
 *  NUDT数据安全态势
 * @author: Paul
 * @create: 2025-07-29 15:16
 */
@Data
@Builder
public class DataAnalysisResp {


    /**
     * 漏洞扫描
     */
    private String scanVulSUM;
    /**
     * 使用人数
     */
    private String useUserSUM;
    /**
     * 执行任务
     */
    private String taskSUM;
    /**
     * 漏洞总数
     */
    private String vulSUM;
    /**
     * 高危漏洞
     */
    private String perilousVulSUM;

    /**
     * 漏洞监测分布概览
     */
    private List<HoopVulCount> hoopVulCountList;

    /**
     * 资源分配数据概览
     */
    private List<ResourceDistCount> resourceDistCountList;

    /**
     * 漏洞监测数据概览
     */
    private List<VulInfo> VulMonitorCountList;


    /**
     * 漏洞监测分布概览
     */
    @Data
    @Builder
    public static class HoopVulCount{
        /**
         * 城市
         */
        private String city;
        /**
         * 百分比 两位小数
         */
        private BigDecimal value;

        private String count;
    }

   /**
     * 资源分配数据概览
     */
    @Data
    public static class ResourceDistCount{
       private static final List<String> CITIES = List.of(
               "北京市", "上海市", "天津市", "重庆市",
               "成都市", "长沙市"
       );
       /**
        * 机器id
        */
       private Long id;

       private String name;

       /**
        * 机器唯一标识
        */
       private String tag;

       private String hostIp;

       private String description;

       //1：Linux  2：Windows
       private Integer machineInfoType;

       private String type;

       private String country;


       private Integer sshPort;

       public void setMachineInfoType(Integer machineInfoType) {
           this.country = CITIES.get(new Random().nextInt(CITIES.size()));
           this.machineInfoType = machineInfoType;
           this.type = machineInfoType.equals(MachineSystemEnum.WINDOWS.getSystem())?MachineSystemEnum.WINDOWS.name():MachineSystemEnum.LINUX.name();
       }
   }

}
