package com.psg.dlsysinfo.dl_sysinfo_server.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.time.LocalDateTime;

// InstalledSoftware.java

@Getter
@Setter
@NoArgsConstructor
@Entity
@Table(name = "installed_software")
public class InstalledSoftware {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long softwareId;

    @ManyToOne
    @JoinColumn(name = "deviceId", nullable = false)
    @JsonIgnore
    private Devices device;

    private String appName;
    private String appVersion;
    private String publisher;

    @Column(name = "normalized_product")
    private String normalizedProduct;

    @Column(name = "normalized_app_name")
    private String normalizedAppName;

    @Column(name = "normalized_publisher")
    private String normalizedPublisher;

    @Column(name = "last_updated", nullable = false)
    private LocalDateTime lastUpdated = LocalDateTime.now();

    // ✅ Manual alias getter
    public Long getId() {
        return softwareId;
    }
}
