visitor_page_entity.g.dart 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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>?)
  22. ?.map(
  23. (e) => jsonConvert.convert<VisitorPageList>(e) as VisitorPageList)
  24. .toList();
  25. if (list != null) {
  26. visitorPageEntity.list = list;
  27. }
  28. return visitorPageEntity;
  29. }
  30. Map<String, dynamic> $VisitorPageEntityToJson(VisitorPageEntity entity) {
  31. final Map<String, dynamic> data = <String, dynamic>{};
  32. data['count'] = entity.count;
  33. data['page'] = entity.page;
  34. data['limit'] = entity.limit;
  35. data['count_page'] = entity.countPage;
  36. data['list'] = entity.list.map((v) => v.toJson()).toList();
  37. return data;
  38. }
  39. extension VisitorPageEntityExtension on VisitorPageEntity {
  40. VisitorPageEntity copyWith({
  41. int? count,
  42. int? page,
  43. int? limit,
  44. int? countPage,
  45. List<VisitorPageList>? list,
  46. }) {
  47. return VisitorPageEntity()
  48. ..count = count ?? this.count
  49. ..page = page ?? this.page
  50. ..limit = limit ?? this.limit
  51. ..countPage = countPage ?? this.countPage
  52. ..list = list ?? this.list;
  53. }
  54. }
  55. VisitorPageList $VisitorPageListFromJson(Map<String, dynamic> json) {
  56. final VisitorPageList visitorPageList = VisitorPageList();
  57. final String? id = jsonConvert.convert<String>(json['id']);
  58. if (id != null) {
  59. visitorPageList.id = id;
  60. }
  61. final String? name = jsonConvert.convert<String>(json['name']);
  62. if (name != null) {
  63. visitorPageList.name = name;
  64. }
  65. final String? phone = jsonConvert.convert<String>(json['phone']);
  66. if (phone != null) {
  67. visitorPageList.phone = phone;
  68. }
  69. final String? nric = jsonConvert.convert<String>(json['nric']);
  70. if (nric != null) {
  71. visitorPageList.nric = nric;
  72. }
  73. final String? vehicleNumber = jsonConvert.convert<String>(
  74. json['vehicle_number']);
  75. if (vehicleNumber != null) {
  76. visitorPageList.vehicleNumber = vehicleNumber;
  77. }
  78. final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  79. if (createdAt != null) {
  80. visitorPageList.createdAt = createdAt;
  81. }
  82. final String? note = jsonConvert.convert<String>(json['note']);
  83. if (note != null) {
  84. visitorPageList.note = note;
  85. }
  86. return visitorPageList;
  87. }
  88. Map<String, dynamic> $VisitorPageListToJson(VisitorPageList entity) {
  89. final Map<String, dynamic> data = <String, dynamic>{};
  90. data['id'] = entity.id;
  91. data['name'] = entity.name;
  92. data['phone'] = entity.phone;
  93. data['nric'] = entity.nric;
  94. data['vehicle_number'] = entity.vehicleNumber;
  95. data['created_at'] = entity.createdAt;
  96. data['note'] = entity.note;
  97. return data;
  98. }
  99. extension VisitorPageListExtension on VisitorPageList {
  100. VisitorPageList copyWith({
  101. String? id,
  102. String? name,
  103. String? phone,
  104. String? nric,
  105. String? vehicleNumber,
  106. String? createdAt,
  107. String? note,
  108. }) {
  109. return VisitorPageList()
  110. ..id = id ?? this.id
  111. ..name = name ?? this.name
  112. ..phone = phone ?? this.phone
  113. ..nric = nric ?? this.nric
  114. ..vehicleNumber = vehicleNumber ?? this.vehicleNumber
  115. ..createdAt = createdAt ?? this.createdAt
  116. ..note = note ?? this.note;
  117. }
  118. }