package com.hiveops.aria.entity;

import jakarta.persistence.*;
import lombok.*;

import java.time.Instant;

@Entity
@Table(name = "device_security_posture")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class DeviceSecurityPosture {

    @Id
    @Column(name = "device_id")
    private Long deviceId;

    @Column(name = "device_agent_id")
    private String deviceAgentId;

    @Column(name = "institution_key")
    private String institutionKey;

    @Column(name = "audit_policy_compliant")
    private Boolean auditPolicyCompliant;

    @Column(name = "gold_image_validated_at")
    private Instant goldImageValidatedAt;

    @Column(name = "gold_image_hash")
    private String goldImageHash;

    @Column(name = "current_image_hash")
    private String currentImageHash;

    @Column(name = "disk_encryption_enabled")
    private Boolean diskEncryptionEnabled;

    @Column(name = "os_version")
    private String osVersion;

    @Enumerated(EnumType.STRING)
    @Column(name = "os_eol_status", nullable = false, columnDefinition = "os_eol_status")
    @Builder.Default
    private OsEolStatus osEolStatus = OsEolStatus.UNKNOWN;

    @Column(name = "software_whitelist_enabled")
    private Boolean softwareWhitelistEnabled;

    @Column(name = "last_posture_check_at")
    private Instant lastPostureCheckAt;

    @Column(name = "posture_score")
    private Integer postureScore;

    @Column(name = "updated_at", nullable = false)
    @Builder.Default
    private Instant updatedAt = Instant.now();

    public enum OsEolStatus {
        SUPPORTED, EOL, UNKNOWN
    }
}
