79 lines
1.8 KiB
Dart
79 lines
1.8 KiB
Dart
class ServiceListResponse {
|
|
final bool success;
|
|
final String message;
|
|
final List<Service> data;
|
|
final dynamic errors;
|
|
final int statusCode;
|
|
final String timestamp;
|
|
|
|
ServiceListResponse({
|
|
required this.success,
|
|
required this.message,
|
|
required this.data,
|
|
this.errors,
|
|
required this.statusCode,
|
|
required this.timestamp,
|
|
});
|
|
|
|
factory ServiceListResponse.fromJson(Map<String, dynamic> json) {
|
|
return ServiceListResponse(
|
|
success: json['success'] ?? false,
|
|
message: json['message'] ?? '',
|
|
data: (json['data'] as List<dynamic>?)
|
|
?.map((e) => Service.fromJson(e))
|
|
.toList() ??
|
|
[],
|
|
errors: json['errors'],
|
|
statusCode: json['statusCode'] ?? 0,
|
|
timestamp: json['timestamp'] ?? '',
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'success': success,
|
|
'message': message,
|
|
'data': data.map((e) => e.toJson()).toList(),
|
|
'errors': errors,
|
|
'statusCode': statusCode,
|
|
'timestamp': timestamp,
|
|
};
|
|
}
|
|
}
|
|
|
|
class Service {
|
|
final String id;
|
|
final String name;
|
|
final String description;
|
|
final bool isSystem;
|
|
final bool isActive;
|
|
|
|
Service({
|
|
required this.id,
|
|
required this.name,
|
|
required this.description,
|
|
required this.isSystem,
|
|
required this.isActive,
|
|
});
|
|
|
|
factory Service.fromJson(Map<String, dynamic> json) {
|
|
return Service(
|
|
id: json['id'] ?? '',
|
|
name: json['name'] ?? '',
|
|
description: json['description'] ?? '',
|
|
isSystem: json['isSystem'] ?? false,
|
|
isActive: json['isActive'] ?? false,
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'id': id,
|
|
'name': name,
|
|
'description': description,
|
|
'isSystem': isSystem,
|
|
'isActive': isActive,
|
|
};
|
|
}
|
|
}
|