Untitled
unknown
plain_text
a year ago
13 kB
8
Indexable
import 'dart:convert';
import 'package:Buildeffective/src/networks/model/app_base_response.dart';
import 'package:nb_utils/nb_utils.dart';
class PropertyBuildingInfoResponse {
PropertyBuildingInfoResponse({this.myProperty, this.status, this.error});
final MyProperty? myProperty;
final String? status;
final ErrorCode? error;
factory PropertyBuildingInfoResponse.fromRawJson(String str) => PropertyBuildingInfoResponse.fromJson(json.decode(str) as Map<String, dynamic>);
String toRawJson() => json.encode(toJson());
factory PropertyBuildingInfoResponse.fromJson(Map<String, dynamic> json) {
return PropertyBuildingInfoResponse(
status: json["status"] != null ? json["status"] : null,
myProperty: json["data"] == null ? null : MyProperty.fromJson(json["data"] as Map<String, dynamic>),
error: json['errors'] != null ? new ErrorCode.fromJson(json['errors']) : null,
);
}
Map<String, dynamic> toJson() => {"data": myProperty == null ? null : myProperty!.toJson()};
}
class MyProperty {
int? id;
String? slug;
String? name;
String? propertyCounter;
int? propertyStatusId;
String? propertyStatusName;
String? propertyStatusSlug;
bool? isHoa;
String? addressText;
String? propertyType;
int? noOfBedroom;
int? noOfBathroom;
String? squareFt;
num? lotSize;
int? photosCount;
bool? isChatEnable;
List<Photos>? photos;
List<Buildings>? buildings;
List<AttachmentDocs>? attachmentDocs;
List<PropertyOwner>? propertyOwners;
double? platformFees;
List<String>? addresses;
MyProperty({
this.id,
this.slug,
this.name,
this.propertyCounter,
this.propertyStatusId,
this.propertyStatusName,
this.propertyStatusSlug,
this.isHoa,
this.addressText,
this.propertyType,
this.noOfBedroom,
this.noOfBathroom,
this.squareFt,
this.lotSize,
this.photosCount,
this.isChatEnable,
this.photos,
this.buildings,
this.attachmentDocs,
this.propertyOwners,
this.platformFees,
this.addresses,
});
MyProperty.fromJson(Map<String, dynamic> json) {
id = json['id'];
slug = json['slug'];
name = json['name'];
propertyCounter = json['property_counter'];
propertyStatusId = json['property_status_id'];
propertyStatusName = json['property_status_name'];
propertyStatusSlug = json['property_status_slug'];
isHoa = json['is_hoa'];
addressText = json['address_text'];
propertyType = json['property_type'];
noOfBedroom = json['no_of_bedroom'];
noOfBathroom = json['no_of_bathroom'];
squareFt = json['square_ft'];
lotSize = json['lot_size'] != null ? json['lot_size'].toString().toDouble() : null;
platformFees = json['platformFees'];
addresses = json["addresses"] == null ? null : (json["addresses"] as List).cast<String>();
photosCount = json['photos_count'];
isChatEnable = json['is_chat_enable'];
propertyOwners = json["property_owners"] == null ? null : List<PropertyOwner>.from(json["property_owners"].map((x) => PropertyOwner.fromJson(x as Map<String, dynamic>)) as Iterable);
if (json['photos'] != null) {
photos = <Photos>[];
json['photos'].forEach((v) {
photos!.add(new Photos.fromJson(v));
});
}
if (json['buildings'] != null) {
buildings = <Buildings>[];
json['buildings'].forEach((v) {
buildings!.add(new Buildings.fromJson(v));
});
}
attachmentDocs = json['attachment_docs'] != null ? (json['attachment_docs'] as List).map((e) => AttachmentDocs.fromJson(e)).toList() : null;
/*if (json['attachment_docs'] != null) {
attachmentDocs = null;
json['attachment_docs'].forEach((v) {
attachmentDocs?.add(new AttachmentDocs.fromJson(v));
});
}*/
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['slug'] = this.slug;
data['name'] = this.name;
data["property_owners"] = propertyOwners == null ? null : List<dynamic>.from(propertyOwners!.map((x) => x.toJson()));
data['property_counter'] = this.propertyCounter;
data['property_status_id'] = this.propertyStatusId;
data['property_status_name'] = this.propertyStatusName;
data['property_status_slug'] = this.propertyStatusSlug;
data['is_hoa'] = this.isHoa;
data['address_text'] = this.addressText;
data['property_type'] = this.propertyType;
data['no_of_bedroom'] = this.noOfBedroom;
data['no_of_bathroom'] = this.noOfBathroom;
data['square_ft'] = this.squareFt;
data['platformFees'] = this.platformFees;
data["addresses"] = addresses == null ? null : List<dynamic>.from(addresses!.map((x) => x));
data['lot_size'] = this.lotSize;
data['photos_count'] = this.photosCount;
data['is_chat_enable'] = this.isChatEnable;
if (this.photos != null) {
data['photos'] = this.photos!.map((v) => v.toJson()).toList();
}
if (this.buildings != null) {
data['buildings'] = this.buildings!.map((v) => v.toJson()).toList();
}
if (this.attachmentDocs != null) {
data['attachment_docs'] = this.attachmentDocs!.map((v) => v.toJson()).toList();
}
return data;
}
}
class Photos {
int? id;
String? slug;
String? title;
String? url;
String? originalUrl;
String? contentType;
bool? isPrimary;
Photos({this.id, this.slug, this.title, this.url, this.originalUrl, this.contentType, this.isPrimary});
Photos.fromJson(Map<String, dynamic> json) {
id = json['id'];
slug = json['slug'];
title = json['title'];
url = json['url'];
originalUrl = json['original_url'];
contentType = json['content_type'];
isPrimary = json['is_primary'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['slug'] = this.slug;
data['title'] = this.title;
data['url'] = this.url;
data['original_url'] = this.originalUrl;
data['content_type'] = this.contentType;
data['is_primary'] = this.isPrimary;
return data;
}
}
class Buildings {
int? id;
int? buildingNumber;
String? buildingName;
String? squareFt;
num? carSpace;
BuildingType? buildingType;
List<Units>? units;
Buildings({this.id, this.buildingNumber, this.buildingName, this.squareFt, this.carSpace, this.buildingType, this.units});
Buildings.fromJson(Map<String, dynamic> json) {
id = json['id'];
buildingNumber = json['building_number'];
buildingName = json['building_name'];
squareFt = json['square_ft'];
carSpace = json['car_space'];
buildingType = json['building_type'] != null ? new BuildingType.fromJson(json['building_type']) : null;
if (json['units'] != null) {
units = <Units>[];
json['units'].forEach((v) {
units!.add(new Units.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['building_number'] = this.buildingNumber;
data['building_name'] = this.buildingName;
data['square_ft'] = this.squareFt;
data['car_space'] = this.carSpace;
if (this.buildingType != null) {
data['building_type'] = this.buildingType!.toJson();
}
if (this.units != null) {
data['units'] = this.units!.map((v) => v.toJson()).toList();
}
return data;
}
}
class BuildingType {
int? id;
String? slug;
String? name;
String? nature;
BuildingType({this.id, this.slug, this.name, this.nature});
BuildingType.fromJson(Map<String, dynamic> json) {
id = json['id'];
slug = json['slug'];
name = json['name'];
nature = json['nature'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['slug'] = this.slug;
data['name'] = this.name;
data['nature'] = this.nature;
return data;
}
}
class Units {
int? id;
String? slug;
String? unitNumber;
int? noOfBedroom;
int? noOfBathroom;
List<int>? floors;
Units({this.id, this.slug, this.unitNumber, this.noOfBedroom, this.noOfBathroom, this.floors});
Units.fromJson(Map<String, dynamic> json) {
id = json['id'];
slug = json['slug'];
unitNumber = json['unit_number'];
noOfBedroom = json['no_of_bedroom'];
noOfBathroom = json['no_of_bathroom'];
floors = json['floors'].cast<int>();
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['slug'] = this.slug;
data['unit_number'] = this.unitNumber;
data['no_of_bedroom'] = this.noOfBedroom;
data['no_of_bathroom'] = this.noOfBathroom;
data['floors'] = this.floors;
return data;
}
}
class AttachmentDocs {
int? id;
String? slug;
String? documentUrl;
String? originalUrl;
String? filename;
String? atTypeName;
AttachmentDocs({this.id, this.slug, this.documentUrl, this.originalUrl, this.filename, this.atTypeName});
AttachmentDocs.fromJson(Map<String, dynamic> json) {
id = json['id'];
slug = json['slug'];
documentUrl = json['document_url'];
originalUrl = json['original_url'];
filename = json['filename'];
atTypeName = json['at_type_name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['slug'] = this.slug;
data['document_url'] = this.documentUrl;
data['original_url'] = this.originalUrl;
data['filename'] = this.filename;
data['at_type_name'] = this.atTypeName;
return data;
}
}
class PropertyOwner {
PropertyOwner({
this.id,
this.slug,
this.firstName,
this.lastName,
this.email,
this.role,
this.contactDetails,
});
final int? id;
final String? slug;
final String? firstName;
final String? lastName;
final String? email;
final String? role;
final List<ContactDetail>? contactDetails;
factory PropertyOwner.fromRawJson(String str) => PropertyOwner.fromJson(json.decode(str) as Map<String, dynamic>);
String toRawJson() => json.encode(toJson());
factory PropertyOwner.fromJson(Map<String, dynamic> json) => PropertyOwner(
id: json["id"] == null ? null : json["id"] as int,
slug: json["slug"] == null ? null : json["slug"] as String,
firstName: json["first_name"] == null ? null : json["first_name"] as String,
lastName: json["last_name"] == null ? null : json["last_name"] as String,
email: json["email"] == null ? null : json["email"] as String,
role: json["role"] == null ? null : json["role"] as String,
contactDetails: json["contact_details"] == null ? null : List<ContactDetail>.from(json["contact_details"].map((x) => ContactDetail.fromJson(x as Map<String, dynamic>)) as Iterable),
);
Map<String, dynamic> toJson() => {
"id": id == null ? null : id,
"slug": slug == null ? null : slug,
"first_name": firstName == null ? null : firstName,
"last_name": lastName == null ? null : lastName,
"email": email == null ? null : email,
"role": role == null ? null : role,
"contact_details": contactDetails == null ? null : List<dynamic>.from(contactDetails!.map((x) => x.toJson())),
};
}
class ContactDetail {
ContactDetail({
this.id,
this.contactMode,
this.contactNumber,
this.slug,
});
final int? id;
final String? contactMode;
final String? contactNumber;
final String? slug;
factory ContactDetail.fromRawJson(String str) => ContactDetail.fromJson(json.decode(str) as Map<String, dynamic>);
String toRawJson() => json.encode(toJson());
factory ContactDetail.fromJson(Map<String, dynamic> json) => ContactDetail(
id: json["id"] == null ? null : json["id"] as int,
contactMode: json["contact_mode"] == null ? null : json["contact_mode"] as String,
contactNumber: json["contact_number"] == null ? null : json["contact_number"] as String,
slug: json["slug"] == null ? null : json["slug"] as String,
);
Map<String, dynamic> toJson() => {
"id": id == null ? null : id,
"contact_mode": contactMode == null ? null : contactMode,
"contact_number": contactNumber == null ? null : contactNumber,
"slug": slug == null ? null : slug,
};
}
Editor is loading...
Leave a Comment