didvan-app/lib/models/ai/bots_model.dart

73 lines
1.8 KiB
Dart

class BotsModel {
int? id;
String? name;
String? image;
String? responseType;
String? description;
List<String>? attachmentType;
int? attachment;
bool? editable;
BotsModel(
{this.id,
this.name,
this.image,
this.attachment,
this.attachmentType,
this.description,
this.editable,
this.responseType});
BotsModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
image = json['image'];
description = json['description'];
if (json['attachmentType'] != null) {
attachmentType = <String>[];
json['attachmentType'].forEach((v) {
attachmentType!.add(v);
});
}
attachment = json['attachment'];
editable = json['editable'];
responseType = json['responseType'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['name'] = name;
data['image'] = image;
data['description'] = description;
if (attachmentType != null) {
data['attachmentType'] = attachmentType!.map((v) => v).toList();
}
data['attachment'] = attachment;
data['editable'] = editable;
data['responseType'] = responseType;
return data;
}
BotsModel copyWith(
{int? id,
String? name,
String? image,
String? responseType,
String? description,
List<String>? attachmentType,
int? attachment,
bool? editable}) {
return BotsModel(
id: id ?? this.id,
name: name ?? this.name,
image: image ?? this.image,
responseType: responseType ?? this.responseType,
description: description ?? this.description,
attachmentType: attachmentType ?? this.attachmentType,
attachment: attachment ?? this.attachment,
editable: editable ?? this.editable,
);
}
}