class GrupoFavoritos { const GrupoFavoritos({ required this.id, required this.nombre, required this.orden, this.protegido = false, }); static const sinAsignarId = 'sin_asignar'; final String id; final String nombre; final int orden; final bool protegido; bool get esSinAsignar => id == sinAsignarId; factory GrupoFavoritos.fromMap(Map map) { return GrupoFavoritos( id: map['id'] as String, nombre: map['nombre'] as String, orden: map['orden'] as int? ?? 0, protegido: (map['protegido'] as int? ?? 0) == 1, ); } Map toMap() { return { 'id': id, 'nombre': nombre, 'orden': orden, 'protegido': protegido ? 1 : 0, }; } GrupoFavoritos copyWith({ String? id, String? nombre, int? orden, bool? protegido, }) { return GrupoFavoritos( id: id ?? this.id, nombre: nombre ?? this.nombre, orden: orden ?? this.orden, protegido: protegido ?? this.protegido, ); } }