package kr.co.accura.wbx.spring.audit;

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

import java.time.LocalDateTime;

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

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

    private Long userId;
    private String username;

    @Column(nullable = false, length = 50)
    private String action;

    @Column(nullable = false, length = 100)
    private String resource;

    private Long resourceId;

    @Column(length = 4000)
    private String detail;

    @Column(length = 50)
    private String ipAddress;

    @Column(updatable = false)
    @Builder.Default
    private LocalDateTime createdAt = LocalDateTime.now();
}
