class DynamicDetailModel {
  String? id;
  String? communityId;
  List<String>? urls;
  String? title;
  String? createdAt;
  bool? enable;
  String? createdBy;
  String? createdByName;
  String? imgUrl;
  String? publishAt;
  String? updateAt;
  String? publishBy;
  String? publishByName;
  String? type;
  String? detailContent;
  List<FilesOfDynamicDetailModel>? files;

  DynamicDetailModel({
    this.id,
    this.communityId,
    this.urls,
    this.title,
    this.createdAt,
    this.enable,
    this.createdBy,
    this.createdByName,
    this.imgUrl,
    this.publishAt,
    this.updateAt,
    this.publishBy,
    this.publishByName,
    this.type,
    this.detailContent,
    this.files,
  });

  DynamicDetailModel.fromJson(json) {
    Map<String, dynamic> map = Map.from(json ?? {});

    id = map['id'];
    communityId = map['communityId'];
    urls = map['urls'];
    title = map['title'];
    createdAt = map['createdAt'];
    enable = map['enable'];
    createdBy = map['createdBy'];
    createdByName = map['createdByName'];
    imgUrl = map['imgUrl'];
    publishAt = map['publishAt'];
    updateAt = map['updateAt'];
    publishBy = map['publishBy'];
    publishByName = map['publishByName'];
    type = map['type'];
    detailContent = map['detailContent'];
    files = List<FilesOfDynamicDetailModel>.from(
        (map["files"] ?? []).map((x) => FilesOfDynamicDetailModel.fromJson(x)));
  }

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = Map<String, dynamic>();

    json['id'] = this.id;
    json['communityId'] = this.communityId;
    json['urls'] = this.urls;
    json['title'] = this.title;
    json['createdAt'] = this.createdAt;
    json['enable'] = this.enable;
    json['createdBy'] = this.createdBy;
    json['createdByName'] = this.createdByName;
    json['imgUrl'] = this.imgUrl;
    json['publishAt'] = this.publishAt;
    json['updateAt'] = this.updateAt;
    json['publishBy'] = this.publishBy;
    json['publishByName'] = this.publishByName;
    json['type'] = this.type;
    json['detailContent'] = this.detailContent;
    json['files'] = List<dynamic>.from((files ?? []).map((x) => x.toJson()));

    return json;
  }
}

class FilesOfDynamicDetailModel {
  String? fileId;
  String? fileName;
  String? fileSuffix;

  FilesOfDynamicDetailModel({
    this.fileId,
    this.fileName,
    this.fileSuffix,
  });

  FilesOfDynamicDetailModel.fromJson(json) {
    Map<String, dynamic> map = Map.from(json ?? {});

    fileId = map['fileId'];
    fileName = map['fileName'];
    fileSuffix = map['fileSuffix'];
  }

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = Map<String, dynamic>();

    json['fileId'] = this.fileId;
    json['fileName'] = this.fileName;
    json['fileSuffix'] = this.fileSuffix;

    return json;
  }
}
