import 'package:hoshan/data/model/ai/bots_model.dart'; class ChatsHistoryModel { List? chats; int? page; int? totalCount; int? lastPage; ChatsHistoryModel({this.chats}); ChatsHistoryModel.fromJson(Map json) { if (json['chats'] != null) { chats = []; json['chats'].forEach((v) { chats!.add(Chats.fromJson(v)); }); } page = json['page']; totalCount = json['total_count']; lastPage = json['last_page']; } Map toJson() { final Map data = {}; if (chats != null) { data['chats'] = chats!.map((v) => v.toJson()).toList(); } data['page'] = page; data['total_count'] = totalCount; data['last_page'] = lastPage; return data; } } class Chats { int? id; String? title; String? createdAt; Bots? bot; Chats({this.id, this.title, this.createdAt, this.bot}); Chats.fromJson(Map json) { id = json['id']; title = json['title']; createdAt = json['created_at']; bot = json['bot'] != null ? Bots.fromJson(json['bot']) : null; } Map toJson() { final Map data = {}; data['id'] = id; data['title'] = title; data['created_at'] = createdAt; if (bot != null) { data['bot'] = bot!.toJson(); } return data; } Chats copyWith({int? id, String? title, String? createdAt, Bots? bot}) { return Chats( id: id ?? this.id, title: title ?? this.title, createdAt: createdAt ?? this.createdAt, bot: bot ?? this.bot, ); } }