package net.siegeln.cameleer.saas.audit;

import java.time.Instant;
import java.util.List;
import java.util.UUID;

public final class AuditDto {

    private AuditDto() {}

    public record AuditLogEntry(
        UUID id,
        String actorEmail,
        UUID tenantId,
        String action,
        String resource,
        String environment,
        String result,
        String sourceIp,
        Instant createdAt
    ) {
        public static AuditLogEntry from(AuditEntity e) {
            return new AuditLogEntry(
                e.getId(), e.getActorEmail(), e.getTenantId(),
                e.getAction(), e.getResource(), e.getEnvironment(),
                e.getResult(), e.getSourceIp(), e.getCreatedAt()
            );
        }
    }

    public record AuditLogPage(
        List<AuditLogEntry> content,
        int page,
        int size,
        long totalElements,
        int totalPages
    ) {}
}
