/// Modèle d'entrée de log système
/// Correspond à SystemLogResponse du backend
library system_log_model;

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

part 'system_log_model.g.dart';

@JsonSerializable(explicitToJson: true)
class SystemLogModel extends Equatable {
  final String? id;
  final String? level; // CRITICAL, ERROR, WARN, INFO, DEBUG, TRACE
  final String? source; // API, Auth, Database, Cache, Security, Performance, System
  final String? message;
  final String? details;
  final DateTime? timestamp;
  final String? username;
  final String? ipAddress;
  final String? requestId;
  final String? stackTrace;

  const SystemLogModel({
    this.id,
    this.level,
    this.source,
    this.message,
    this.details,
    this.timestamp,
    this.username,
    this.ipAddress,
    this.requestId,
    this.stackTrace,
  });

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

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

  @override
  List<Object?> get props => [
        id,
        level,
        source,
        message,
        details,
        timestamp,
        username,
        ipAddress,
        requestId,
        stackTrace,
      ];
}
