/// Modèle de configuration des sauvegardes
/// Correspond à BackupConfigResponse du backend
library backup_config_model;

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

part 'backup_config_model.g.dart';

@JsonSerializable(explicitToJson: true)
class BackupConfigModel extends Equatable {
  final bool? autoBackupEnabled;
  final String? frequency; // HOURLY, DAILY, WEEKLY
  final String? retention;
  final int? retentionDays;
  final String? backupTime;
  final bool? includeDatabase;
  final bool? includeFiles;
  final bool? includeConfiguration;
  final DateTime? lastBackup;
  final DateTime? nextScheduledBackup;
  final int? totalBackups;
  final int? totalSizeBytes;
  final String? totalSizeFormatted;

  const BackupConfigModel({
    this.autoBackupEnabled,
    this.frequency,
    this.retention,
    this.retentionDays,
    this.backupTime,
    this.includeDatabase,
    this.includeFiles,
    this.includeConfiguration,
    this.lastBackup,
    this.nextScheduledBackup,
    this.totalBackups,
    this.totalSizeBytes,
    this.totalSizeFormatted,
  });

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

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

  @override
  List<Object?> get props => [
        autoBackupEnabled,
        frequency,
        retention,
        retentionDays,
        backupTime,
        includeDatabase,
        includeFiles,
        includeConfiguration,
        lastBackup,
        nextScheduledBackup,
        totalBackups,
        totalSizeBytes,
        totalSizeFormatted,
      ];
}
