/// Modèle de configuration système
/// Correspond à SystemConfigResponse du backend
library system_config_model;

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

part 'system_config_model.g.dart';

@JsonSerializable(explicitToJson: true)
class SystemConfigModel extends Equatable {
  // Configuration générale
  final String? applicationName;
  final String? timezone;
  final String? defaultLanguage;
  final bool? maintenanceMode;
  final String? version;
  final DateTime? lastUpdated;

  // Configuration réseau
  final int? networkTimeout;
  final int? maxRetries;
  final int? connectionPoolSize;

  // Configuration sécurité
  final bool? twoFactorAuthEnabled;
  final int? sessionTimeoutMinutes;
  final bool? auditLoggingEnabled;

  // Configuration performance
  final bool? metricsCollectionEnabled;
  final int? metricsIntervalSeconds;
  final bool? performanceOptimizationEnabled;

  // Configuration backup
  final bool? autoBackupEnabled;
  final String? backupFrequency;
  final int? backupRetentionDays;
  final DateTime? lastBackup;

  // Configuration logs
  final String? logLevel;
  final int? logRetentionDays;
  final bool? detailedLoggingEnabled;
  final bool? logCompressionEnabled;

  // Configuration monitoring
  final bool? realTimeMonitoringEnabled;
  final int? monitoringIntervalSeconds;
  final bool? emailAlertsEnabled;
  final bool? pushAlertsEnabled;

  // Configuration alertes
  final bool? cpuHighAlertEnabled;
  final int? cpuThresholdPercent;
  final bool? memoryLowAlertEnabled;
  final int? memoryThresholdPercent;
  final bool? criticalErrorAlertEnabled;
  final bool? connectionFailureAlertEnabled;
  final int? connectionFailureThreshold;

  // Statut système
  final String? systemStatus;
  final int? uptime;

  const SystemConfigModel({
    this.applicationName,
    this.timezone,
    this.defaultLanguage,
    this.maintenanceMode,
    this.version,
    this.lastUpdated,
    this.networkTimeout,
    this.maxRetries,
    this.connectionPoolSize,
    this.twoFactorAuthEnabled,
    this.sessionTimeoutMinutes,
    this.auditLoggingEnabled,
    this.metricsCollectionEnabled,
    this.metricsIntervalSeconds,
    this.performanceOptimizationEnabled,
    this.autoBackupEnabled,
    this.backupFrequency,
    this.backupRetentionDays,
    this.lastBackup,
    this.logLevel,
    this.logRetentionDays,
    this.detailedLoggingEnabled,
    this.logCompressionEnabled,
    this.realTimeMonitoringEnabled,
    this.monitoringIntervalSeconds,
    this.emailAlertsEnabled,
    this.pushAlertsEnabled,
    this.cpuHighAlertEnabled,
    this.cpuThresholdPercent,
    this.memoryLowAlertEnabled,
    this.memoryThresholdPercent,
    this.criticalErrorAlertEnabled,
    this.connectionFailureAlertEnabled,
    this.connectionFailureThreshold,
    this.systemStatus,
    this.uptime,
  });

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

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

  @override
  List<Object?> get props => [
        applicationName,
        timezone,
        defaultLanguage,
        maintenanceMode,
        version,
        lastUpdated,
        networkTimeout,
        maxRetries,
        connectionPoolSize,
        twoFactorAuthEnabled,
        sessionTimeoutMinutes,
        auditLoggingEnabled,
        metricsCollectionEnabled,
        metricsIntervalSeconds,
        performanceOptimizationEnabled,
        autoBackupEnabled,
        backupFrequency,
        backupRetentionDays,
        lastBackup,
        logLevel,
        logRetentionDays,
        detailedLoggingEnabled,
        logCompressionEnabled,
        realTimeMonitoringEnabled,
        monitoringIntervalSeconds,
        emailAlertsEnabled,
        pushAlertsEnabled,
        cpuHighAlertEnabled,
        cpuThresholdPercent,
        memoryLowAlertEnabled,
        memoryThresholdPercent,
        criticalErrorAlertEnabled,
        connectionFailureAlertEnabled,
        connectionFailureThreshold,
        systemStatus,
        uptime,
      ];
}
