package com.psg.dlsysinfo.dl_sysinfo_server.entity;

import jakarta.persistence.*;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Entity
@Table(name = "cves")
@Getter
@Setter
@NoArgsConstructor
public class Cve {

    @Id
    private String id;  // CVE-2024-10556

    @Column(columnDefinition = "TEXT")
    private String description;

    @Column(name = "published_date")
    private String publishedDate;

    @Column(name = "last_modified_date")
    private String lastModifiedDate;

    private String severity; // (Old "primary severity" field)

    @Column(name = "cvss_score")
    private Double cvssScore; // (Old "primary score" field)

    // === New Enrichment Fields ===

    @Column(name = "severity_v2")
    private String severityV2;

    @Column(name = "cvss_score_v2")
    private Double cvssScoreV2;

    @Column(name = "cvss_vector_v2")
    private String cvssVectorV2;

    @Column(name = "severity_v3")
    private String severityV3;

    @Column(name = "cvss_score_v3")
    private Double cvssScoreV3;

    @Column(name = "cvss_vector_v3")
    private String cvssVectorV3;

    @Column(name = "severity_v4")
    private String severityV4;

    @Column(name = "cvss_score_v4")
    private Double cvssScoreV4;

    @Column(name = "cvss_vector_v4")
    private String cvssVectorV4;

    @Column(name = "cwe_ids", columnDefinition = "TEXT")
    private String cweIds;

    @Column(name = "references", columnDefinition = "TEXT")
    private String referencesField; // ⭐ You can't name a field `references` in Java easily, so slight rename.

    @Column(name = "hasKev")
    private Boolean hasKev = false;

    @Column(name = "hasCertNotes")
    private Boolean hasCertNotes = false;

    @Column(name = "hasCertAlerts")
    private Boolean hasCertAlerts = false;

    @Column(name = "source")
    private String source = "NVD";
}
