class RelaisModel {
  final String id;
  final String nom;
  final String adresse;
  final Map<String, dynamic>? horairesOuverture;
  final String? ligneFixe;
  final bool actif;
  final String? notes;

  const RelaisModel({
    required this.id,
    required this.nom,
    required this.adresse,
    this.horairesOuverture,
    this.ligneFixe,
    required this.actif,
    this.notes,
  });

  factory RelaisModel.fromJson(Map<String, dynamic> json) {
    return RelaisModel(
      id: (json['id'] ?? '').toString(),
      nom: (json['nom'] ?? '').toString(),
      adresse: (json['adresse'] ?? '').toString(),
      horairesOuverture: json['horaires_ouverture'] is Map<String, dynamic>
          ? json['horaires_ouverture'] as Map<String, dynamic>
          : null,
      ligneFixe: json['ligne_fixe'] as String?,
      actif: json['actif'] as bool? ?? true,
      notes: json['notes'] as String?,
    );
  }
}
