package com.saas.admin.dto.response;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.Map;

/**
 * Audit Log Response DTO
 * 
 * Immutable representation of an audit log entry for API responses.
 * Contains all audit information including user, entity, changes, and metadata.
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class AuditLogResponse {

    private Long id;
    
    private Long userId;
    private String userEmail;
    
    private String action;
    
    private String entityType;
    private Long entityId;
    
    private String tenantId;
    
    /**
     * Serialized JSON map of old entity values before change
     * Null for CREATE operations
     */
    private Map<String, Object> oldValues;
    
    /**
     * Serialized JSON map of new entity values after change
     * Null for DELETE operations
     */
    private Map<String, Object> newValues;
    
    private String ipAddress;
    private String userAgent;
    
    private LocalDateTime createdAt;
    
    /**
     * Human-readable description of the change
     */
    private String description;
}
