class FileModel {
  FileModel({
    required this.id,
    required this.name,
    required this.extName,
    required this.path,
    required this.type,
    required this.size,
    required this.createdAt,
    required this.username,
    required this.bussinessRecordId,
    required this.bussinessModule,
  });

  final int? id;
  final String? name;
  final String? extName;
  final String? path;
  final String? type;
  final String? size;
  final DateTime? createdAt;
  final String? username;
  final int? bussinessRecordId;
  final String? bussinessModule;

  factory FileModel.fromJson(Map<String, dynamic> json) {
    return FileModel(
      id: json["id"],
      name: json["name"],
      extName: json["extName"],
      path: json["path"],
      type: json["type"],
      size: json["size"],
      createdAt: DateTime.tryParse(json["createdAt"] ?? ""),
      username: json["username"],
      bussinessRecordId: json["bussinessRecordId"],
      bussinessModule: json["bussinessModule"],
    );
  }

  Map<String, dynamic> toJson() => {
        "id": id,
        "name": name,
        "extName": extName,
        "path": path,
        "type": type,
        "size": size,
        "createdAt": createdAt?.toIso8601String(),
        "username": username,
        "bussinessRecordId": bussinessRecordId,
        "bussinessModule": bussinessModule,
      };
}
