/// Modèle des statistiques de cache système
/// Correspond à CacheStatsResponse du backend
library cache_stats_model;

import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';

part 'cache_stats_model.g.dart';

@JsonSerializable(explicitToJson: true)
class CacheStatsModel extends Equatable {
  final int? totalSizeBytes;
  final String? totalSizeFormatted;
  final int? totalEntries;
  final double? hitRate;
  final int? hits;
  final int? misses;
  final DateTime? lastCleared;

  const CacheStatsModel({
    this.totalSizeBytes,
    this.totalSizeFormatted,
    this.totalEntries,
    this.hitRate,
    this.hits,
    this.misses,
    this.lastCleared,
  });

  factory CacheStatsModel.fromJson(Map<String, dynamic> json) =>
      _$CacheStatsModelFromJson(json);

  Map<String, dynamic> toJson() => _$CacheStatsModelToJson(this);

  @override
  List<Object?> get props => [
        totalSizeBytes,
        totalSizeFormatted,
        totalEntries,
        hitRate,
        hits,
        misses,
        lastCleared,
      ];
}
