package dev.lions.unionflow.server.api.dto.system.response;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

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

/**
 * Response contenant les statistiques du cache système
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CacheStatsResponse {

    private Long totalSizeBytes;
    private String totalSizeFormatted; // ex: "2.3 GB"
    private Integer totalEntries;
    private Double hitRate; // pourcentage (0-100)
    private Long hits;
    private Long misses;
    private LocalDateTime lastCleared;

    // Statistiques par cache
    private Map<String, CacheEntry> caches;

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class CacheEntry {
        private String name;
        private Long sizeBytes;
        private Integer entries;
        private Double hitRate;
        private Long hits;
        private Long misses;
        private LocalDateTime lastAccessed;
    }
}
