class Instruction { final String? id; final String title; final String content; final List tags; final DateTime createdAt; Instruction({ this.id, required this.title, required this.content, required this.tags, required this.createdAt, }); Instruction copyWith({ String? id, String? title, String? content, List? tags, DateTime? createdAt, }) { return Instruction( id: id ?? this.id, title: title ?? this.title, content: content ?? this.content, tags: tags ?? this.tags, createdAt: createdAt ?? this.createdAt, ); } factory Instruction.fromJson(Map json) { return Instruction( id: json['id'], title: json['title'], content: json['content'], tags: List.from(json['tags'] ?? []), createdAt: DateTime.parse(json['createdAt']), ); } Map toJson() { return { 'id': id, 'title': title, 'content': content, 'tags': tags, 'createdAt': createdAt.toIso8601String(), }; } }