visitor_page_entity.g.dart 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/visitor_page_entity.dart';
  3. VisitorPageEntity $VisitorPageEntityFromJson(Map<String, dynamic> json) {
  4. final VisitorPageEntity visitorPageEntity = VisitorPageEntity();
  5. final int? count = jsonConvert.convert<int>(json['count']);
  6. if (count != null) {
  7. visitorPageEntity.count = count;
  8. }
  9. final int? page = jsonConvert.convert<int>(json['page']);
  10. if (page != null) {
  11. visitorPageEntity.page = page;
  12. }
  13. final int? limit = jsonConvert.convert<int>(json['limit']);
  14. if (limit != null) {
  15. visitorPageEntity.limit = limit;
  16. }
  17. final int? countPage = jsonConvert.convert<int>(json['count_page']);
  18. if (countPage != null) {
  19. visitorPageEntity.countPage = countPage;
  20. }
  21. final List<VisitorPageList>? list = (json['list'] as List<dynamic>?)?.map(
  22. (e) => jsonConvert.convert<VisitorPageList>(e) as VisitorPageList).toList();
  23. if (list != null) {
  24. visitorPageEntity.list = list;
  25. }
  26. return visitorPageEntity;
  27. }
  28. Map<String, dynamic> $VisitorPageEntityToJson(VisitorPageEntity entity) {
  29. final Map<String, dynamic> data = <String, dynamic>{};
  30. data['count'] = entity.count;
  31. data['page'] = entity.page;
  32. data['limit'] = entity.limit;
  33. data['count_page'] = entity.countPage;
  34. data['list'] = entity.list.map((v) => v.toJson()).toList();
  35. return data;
  36. }
  37. extension VisitorPageEntityExtension on VisitorPageEntity {
  38. VisitorPageEntity copyWith({
  39. int? count,
  40. int? page,
  41. int? limit,
  42. int? countPage,
  43. List<VisitorPageList>? list,
  44. }) {
  45. return VisitorPageEntity()
  46. ..count = count ?? this.count
  47. ..page = page ?? this.page
  48. ..limit = limit ?? this.limit
  49. ..countPage = countPage ?? this.countPage
  50. ..list = list ?? this.list;
  51. }
  52. }
  53. VisitorPageList $VisitorPageListFromJson(Map<String, dynamic> json) {
  54. final VisitorPageList visitorPageList = VisitorPageList();
  55. final String? id = jsonConvert.convert<String>(json['id']);
  56. if (id != null) {
  57. visitorPageList.id = id;
  58. }
  59. final String? name = jsonConvert.convert<String>(json['name']);
  60. if (name != null) {
  61. visitorPageList.name = name;
  62. }
  63. final String? phone = jsonConvert.convert<String>(json['phone']);
  64. if (phone != null) {
  65. visitorPageList.phone = phone;
  66. }
  67. final String? nric = jsonConvert.convert<String>(json['nric']);
  68. if (nric != null) {
  69. visitorPageList.nric = nric;
  70. }
  71. final String? vehicleNumber = jsonConvert.convert<String>(json['vehicle_number']);
  72. if (vehicleNumber != null) {
  73. visitorPageList.vehicleNumber = vehicleNumber;
  74. }
  75. final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  76. if (createdAt != null) {
  77. visitorPageList.createdAt = createdAt;
  78. }
  79. final String? note = jsonConvert.convert<String>(json['note']);
  80. if (note != null) {
  81. visitorPageList.note = note;
  82. }
  83. return visitorPageList;
  84. }
  85. Map<String, dynamic> $VisitorPageListToJson(VisitorPageList entity) {
  86. final Map<String, dynamic> data = <String, dynamic>{};
  87. data['id'] = entity.id;
  88. data['name'] = entity.name;
  89. data['phone'] = entity.phone;
  90. data['nric'] = entity.nric;
  91. data['vehicle_number'] = entity.vehicleNumber;
  92. data['created_at'] = entity.createdAt;
  93. data['note'] = entity.note;
  94. return data;
  95. }
  96. extension VisitorPageListExtension on VisitorPageList {
  97. VisitorPageList copyWith({
  98. String? id,
  99. String? name,
  100. String? phone,
  101. String? nric,
  102. String? vehicleNumber,
  103. String? createdAt,
  104. String? note,
  105. }) {
  106. return VisitorPageList()
  107. ..id = id ?? this.id
  108. ..name = name ?? this.name
  109. ..phone = phone ?? this.phone
  110. ..nric = nric ?? this.nric
  111. ..vehicleNumber = vehicleNumber ?? this.vehicleNumber
  112. ..createdAt = createdAt ?? this.createdAt
  113. ..note = note ?? this.note;
  114. }
  115. }