first commit
This commit is contained in:
336
lib/modules/authentication/auth.dart
Normal file
336
lib/modules/authentication/auth.dart
Normal file
@@ -0,0 +1,336 @@
|
||||
class Authentication {
|
||||
final String? customerid;
|
||||
final String? firstname;
|
||||
final String? lastname;
|
||||
final String? profileimage;
|
||||
final String? gender;
|
||||
final String? dob;
|
||||
final String? dialcode;
|
||||
final String? contactno;
|
||||
final String? email;
|
||||
final String? deviceid;
|
||||
final String? devicetype;
|
||||
final int? authmode;
|
||||
final int? configid;
|
||||
final String? customertoken;
|
||||
final String? address;
|
||||
final String? suburb;
|
||||
final String? city;
|
||||
final String? state;
|
||||
final String? landmark;
|
||||
final String? doorno;
|
||||
final String? postcode;
|
||||
final String? latitude;
|
||||
final String? longitude;
|
||||
final int? applocationid;
|
||||
final int? locationid;
|
||||
final String? defaultaddress;
|
||||
final int? primaryaddress;
|
||||
final int? tenantid;
|
||||
final int? status;
|
||||
final String? intro;
|
||||
|
||||
// 🆕 Additional fields specific to Profile API
|
||||
final int? deliverylocationid;
|
||||
final int? allocationid;
|
||||
final int? tenantlocationid;
|
||||
final String? selectedlatitude;
|
||||
final String? selectedlongitude;
|
||||
final String? radius;
|
||||
final int? qrmode;
|
||||
|
||||
const Authentication({
|
||||
this.customerid,
|
||||
this.firstname,
|
||||
this.lastname,
|
||||
this.profileimage,
|
||||
this.gender,
|
||||
this.dob,
|
||||
this.dialcode,
|
||||
this.contactno,
|
||||
this.email,
|
||||
this.deviceid,
|
||||
this.devicetype,
|
||||
this.authmode,
|
||||
this.configid,
|
||||
this.customertoken,
|
||||
this.address,
|
||||
this.suburb,
|
||||
this.city,
|
||||
this.state,
|
||||
this.landmark,
|
||||
this.doorno,
|
||||
this.postcode,
|
||||
this.latitude,
|
||||
this.longitude,
|
||||
this.applocationid,
|
||||
this.locationid,
|
||||
this.defaultaddress,
|
||||
this.primaryaddress,
|
||||
this.tenantid,
|
||||
this.status,
|
||||
this.intro,
|
||||
this.deliverylocationid,
|
||||
this.allocationid,
|
||||
this.tenantlocationid,
|
||||
this.selectedlatitude,
|
||||
this.selectedlongitude,
|
||||
this.radius,
|
||||
this.qrmode,
|
||||
});
|
||||
|
||||
factory Authentication.fromJson(Map<String, dynamic> json) {
|
||||
return Authentication(
|
||||
customerid: json['customerid']?.toString(),
|
||||
firstname: json['firstname'],
|
||||
lastname: json['lastname'],
|
||||
profileimage: json['profileimage'],
|
||||
gender: json['gender'],
|
||||
dob: json['dob'],
|
||||
dialcode: json['dialcode'],
|
||||
contactno: json['contactno'],
|
||||
email: json['email'],
|
||||
deviceid: json['deviceid'],
|
||||
devicetype: json['devicetype'],
|
||||
authmode: json['authmode'],
|
||||
configid: json['configid'],
|
||||
customertoken: json['customertoken'],
|
||||
address: json['address'],
|
||||
suburb: json['suburb'],
|
||||
city: json['city'],
|
||||
state: json['state'],
|
||||
landmark: json['landmark'],
|
||||
doorno: json['doorno'],
|
||||
postcode: json['postcode'],
|
||||
latitude: json['latitude'],
|
||||
longitude: json['longitude'],
|
||||
applocationid: json['applocationid'],
|
||||
locationid: json['locationid'],
|
||||
defaultaddress: json['defaultaddress'],
|
||||
primaryaddress: json['primaryaddress'],
|
||||
tenantid: json['tenantid'],
|
||||
status: json['status'],
|
||||
intro: json['intro'],
|
||||
);
|
||||
}
|
||||
|
||||
/// 🏠 Factory for location API
|
||||
factory Authentication.fromLocationJson(Map<String, dynamic> json) {
|
||||
return Authentication(
|
||||
customerid: json['customerid']?.toString(),
|
||||
address: json['address'],
|
||||
suburb: json['suburb'],
|
||||
city: json['city'],
|
||||
state: json['state'],
|
||||
landmark: json['landmark'],
|
||||
doorno: json['doorno'],
|
||||
postcode: json['postcode'],
|
||||
latitude: json['latitude'],
|
||||
longitude: json['longitude'],
|
||||
locationid: json['locationid'],
|
||||
primaryaddress: json['primaryaddress'],
|
||||
status: json['status'],
|
||||
);
|
||||
}
|
||||
|
||||
/// 🆕 Factory for Profile API
|
||||
factory Authentication.fromProfileJson(Map<String, dynamic> json) {
|
||||
final details = json['details'] ?? {};
|
||||
|
||||
return Authentication(
|
||||
customerid: details['customerid']?.toString(),
|
||||
firstname: details['firstname'],
|
||||
lastname: details['lastname'],
|
||||
profileimage: details['profileimage'],
|
||||
gender: details['gender'],
|
||||
dob: details['dob'],
|
||||
dialcode: details['dialcode'],
|
||||
contactno: details['contactno'],
|
||||
email: details['email'],
|
||||
deviceid: details['deviceid'],
|
||||
devicetype: details['devicetype'],
|
||||
authmode: details['authmode'],
|
||||
configid: details['configid'],
|
||||
customertoken: details['customertoken'],
|
||||
address: details['address'],
|
||||
suburb: details['suburb'],
|
||||
city: details['city'],
|
||||
state: details['state'],
|
||||
landmark: details['landmark'],
|
||||
doorno: details['doorno'],
|
||||
postcode: details['postcode'],
|
||||
latitude: details['latitude'],
|
||||
longitude: details['longitude'],
|
||||
applocationid: details['applocationid'],
|
||||
primaryaddress: details['primaryaddress'],
|
||||
tenantid: details['tenantid'],
|
||||
status: details['status'],
|
||||
intro: details['intro'],
|
||||
deliverylocationid: details['deliverylocationid'],
|
||||
allocationid: details['allocationid'],
|
||||
tenantlocationid: details['tenantlocationid'],
|
||||
selectedlatitude: details['selectedlatitude'],
|
||||
selectedlongitude: details['selectedlongitude'],
|
||||
radius: details['radius'],
|
||||
qrmode: details['qrmode'],
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'customerid': customerid,
|
||||
'firstname': firstname,
|
||||
'lastname': lastname,
|
||||
'profileimage': profileimage,
|
||||
'gender': gender,
|
||||
'dob': dob,
|
||||
'dialcode': dialcode,
|
||||
'contactno': contactno,
|
||||
'email': email,
|
||||
'deviceid': deviceid,
|
||||
'devicetype': devicetype,
|
||||
'authmode': authmode,
|
||||
'configid': configid,
|
||||
'customertoken': customertoken,
|
||||
'address': address,
|
||||
'suburb': suburb,
|
||||
'city': city,
|
||||
'state': state,
|
||||
'landmark': landmark,
|
||||
'doorno': doorno,
|
||||
'postcode': postcode,
|
||||
'latitude': latitude,
|
||||
'longitude': longitude,
|
||||
'applocationid': applocationid,
|
||||
'locationid': locationid,
|
||||
'defaultaddress': defaultaddress,
|
||||
'primaryaddress': primaryaddress,
|
||||
'tenantid': tenantid,
|
||||
'status': status,
|
||||
'intro': intro,
|
||||
'deliverylocationid': deliverylocationid,
|
||||
'allocationid': allocationid,
|
||||
'tenantlocationid': tenantlocationid,
|
||||
'selectedlatitude': selectedlatitude,
|
||||
'selectedlongitude': selectedlongitude,
|
||||
'radius': radius,
|
||||
'qrmode': qrmode,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class Customer {
|
||||
final int customerId;
|
||||
final String firstName;
|
||||
final String lastName;
|
||||
final String profileImage;
|
||||
final String gender;
|
||||
final String dob;
|
||||
final String dialCode;
|
||||
final String contactNo;
|
||||
final String email;
|
||||
final String deviceId;
|
||||
final String deviceType;
|
||||
final int authMode;
|
||||
final int configId;
|
||||
final String customerToken;
|
||||
final int deliveryLocationId;
|
||||
final String address;
|
||||
final String suburb;
|
||||
final String city;
|
||||
final String state;
|
||||
final String landmark;
|
||||
final String doorNo;
|
||||
final String postcode;
|
||||
final String latitude;
|
||||
final String longitude;
|
||||
final int appLocationId;
|
||||
final int allocationId;
|
||||
final int primaryAddress;
|
||||
final int tenantLocationId;
|
||||
final int tenantId;
|
||||
final int status;
|
||||
final String intro;
|
||||
final String selectedLatitude;
|
||||
final String selectedLongitude;
|
||||
final String radius;
|
||||
final int qrMode;
|
||||
|
||||
Customer({
|
||||
required this.customerId,
|
||||
required this.firstName,
|
||||
required this.lastName,
|
||||
required this.profileImage,
|
||||
required this.gender,
|
||||
required this.dob,
|
||||
required this.dialCode,
|
||||
required this.contactNo,
|
||||
required this.email,
|
||||
required this.deviceId,
|
||||
required this.deviceType,
|
||||
required this.authMode,
|
||||
required this.configId,
|
||||
required this.customerToken,
|
||||
required this.deliveryLocationId,
|
||||
required this.address,
|
||||
required this.suburb,
|
||||
required this.city,
|
||||
required this.state,
|
||||
required this.landmark,
|
||||
required this.doorNo,
|
||||
required this.postcode,
|
||||
required this.latitude,
|
||||
required this.longitude,
|
||||
required this.appLocationId,
|
||||
required this.allocationId,
|
||||
required this.primaryAddress,
|
||||
required this.tenantLocationId,
|
||||
required this.tenantId,
|
||||
required this.status,
|
||||
required this.intro,
|
||||
required this.selectedLatitude,
|
||||
required this.selectedLongitude,
|
||||
required this.radius,
|
||||
required this.qrMode,
|
||||
});
|
||||
|
||||
factory Customer.fromJson(Map<String, dynamic> json) {
|
||||
return Customer(
|
||||
customerId: json['customerid'] ?? 0,
|
||||
firstName: json['firstname'] ?? '',
|
||||
lastName: json['lastname'] ?? '',
|
||||
profileImage: json['profileimage'] ?? '',
|
||||
gender: json['gender'] ?? '',
|
||||
dob: json['dob'] ?? '',
|
||||
dialCode: json['dialcode'] ?? '',
|
||||
contactNo: json['contactno'] ?? '',
|
||||
email: json['email'] ?? '',
|
||||
deviceId: json['deviceid'] ?? '',
|
||||
deviceType: json['devicetype'] ?? '',
|
||||
authMode: json['authmode'] ?? 0,
|
||||
configId: json['configid'] ?? 0,
|
||||
customerToken: json['customertoken'] ?? '',
|
||||
deliveryLocationId: json['deliverylocationid'] ?? 0,
|
||||
address: json['address'] ?? '',
|
||||
suburb: json['suburb'] ?? '',
|
||||
city: json['city'] ?? '',
|
||||
state: json['state'] ?? '',
|
||||
landmark: json['landmark'] ?? '',
|
||||
doorNo: json['doorno'] ?? '',
|
||||
postcode: json['postcode'] ?? '',
|
||||
latitude: json['latitude'] ?? '',
|
||||
longitude: json['longitude'] ?? '',
|
||||
appLocationId: json['applocationid'] ?? 0,
|
||||
allocationId: json['allocationid'] ?? 0,
|
||||
primaryAddress: json['primaryaddress'] ?? 0,
|
||||
tenantLocationId: json['tenantlocationid'] ?? 0,
|
||||
tenantId: json['tenantid'] ?? 0,
|
||||
status: json['status'] ?? 0,
|
||||
intro: json['intro'] ?? '',
|
||||
selectedLatitude: json['selectedlatitude'] ?? '',
|
||||
selectedLongitude: json['selectedlongitude'] ?? '',
|
||||
radius: json['radius'] ?? '',
|
||||
qrMode: json['qrmode'] ?? 0,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user