import 'package:uuid/uuid.dart'; // Model: Note // - Representa una nota guardada en la app. class Note { Note({ String? id, required this.title, required this.body, required this.createdAt, required this.updatedAt, required this.position, this.categoryId, this.serverVersion = 0, this.isDeleted = false, this.isPermanentlyDeleted = false, this.isDirty = true, }) : id = id ?? Uuid().v4(); final String id; final String title; final String body; final DateTime createdAt; final DateTime updatedAt; final double position; final String? categoryId; final int serverVersion; final bool isDeleted; final bool isPermanentlyDeleted; final bool isDirty; Note copyWith({ String? id, String? title, String? body, DateTime? createdAt, DateTime? updatedAt, double? position, String? categoryId, int? serverVersion, bool? isDeleted, bool? isPermanentlyDeleted, bool? isDirty, }) { return Note( id: id ?? this.id, title: title ?? this.title, body: body ?? this.body, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, position: position ?? this.position, categoryId: categoryId ?? this.categoryId, serverVersion: serverVersion ?? this.serverVersion, isDeleted: isDeleted ?? this.isDeleted, isPermanentlyDeleted: isPermanentlyDeleted ?? this.isPermanentlyDeleted, isDirty: isDirty ?? this.isDirty, ); } @override bool operator ==(Object other) { if (identical(this, other)) { return true; } return other is Note && id == other.id; } @override int get hashCode => id.hashCode; }