hotel_info_entity.g.dart 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/response/hotel_info_entity.dart';
  3. HotelInfoEntity $HotelInfoEntityFromJson(Map<String, dynamic> json) {
  4. final HotelInfoEntity hotelInfoEntity = HotelInfoEntity();
  5. final int? adminId = jsonConvert.convert<int>(json['admin_id']);
  6. if (adminId != null) {
  7. hotelInfoEntity.adminId = adminId;
  8. }
  9. final String? name = jsonConvert.convert<String>(json['name']);
  10. if (name != null) {
  11. hotelInfoEntity.name = name;
  12. }
  13. final int? hotelId = jsonConvert.convert<int>(json['hotel_id']);
  14. if (hotelId != null) {
  15. hotelInfoEntity.hotelId = hotelId;
  16. }
  17. final String? hotelName = jsonConvert.convert<String>(json['hotel_name']);
  18. if (hotelName != null) {
  19. hotelInfoEntity.hotelName = hotelName;
  20. }
  21. final List<HotelInfoMenus>? menus = (json['menus'] as List<dynamic>?)?.map(
  22. (e) => jsonConvert.convert<HotelInfoMenus>(e) as HotelInfoMenus).toList();
  23. if (menus != null) {
  24. hotelInfoEntity.menus = menus;
  25. }
  26. final String? token = jsonConvert.convert<String>(json['token']);
  27. if (token != null) {
  28. hotelInfoEntity.token = token;
  29. }
  30. return hotelInfoEntity;
  31. }
  32. Map<String, dynamic> $HotelInfoEntityToJson(HotelInfoEntity entity) {
  33. final Map<String, dynamic> data = <String, dynamic>{};
  34. data['admin_id'] = entity.adminId;
  35. data['name'] = entity.name;
  36. data['hotel_id'] = entity.hotelId;
  37. data['hotel_name'] = entity.hotelName;
  38. data['menus'] = entity.menus?.map((v) => v.toJson()).toList();
  39. data['token'] = entity.token;
  40. return data;
  41. }
  42. extension HotelInfoEntityExtension on HotelInfoEntity {
  43. HotelInfoEntity copyWith({
  44. int? adminId,
  45. String? name,
  46. int? hotelId,
  47. String? hotelName,
  48. List<HotelInfoMenus>? menus,
  49. String? token,
  50. }) {
  51. return HotelInfoEntity()
  52. ..adminId = adminId ?? this.adminId
  53. ..name = name ?? this.name
  54. ..hotelId = hotelId ?? this.hotelId
  55. ..hotelName = hotelName ?? this.hotelName
  56. ..menus = menus ?? this.menus
  57. ..token = token ?? this.token;
  58. }
  59. }
  60. HotelInfoMenus $HotelInfoMenusFromJson(Map<String, dynamic> json) {
  61. final HotelInfoMenus hotelInfoMenus = HotelInfoMenus();
  62. final String? key = jsonConvert.convert<String>(json['key']);
  63. if (key != null) {
  64. hotelInfoMenus.key = key;
  65. }
  66. final String? name = jsonConvert.convert<String>(json['name']);
  67. if (name != null) {
  68. hotelInfoMenus.name = name;
  69. }
  70. final List<HotelInfoMenusChildren>? children = (json['children'] as List<dynamic>?)?.map(
  71. (e) => jsonConvert.convert<HotelInfoMenusChildren>(e) as HotelInfoMenusChildren).toList();
  72. if (children != null) {
  73. hotelInfoMenus.children = children;
  74. }
  75. return hotelInfoMenus;
  76. }
  77. Map<String, dynamic> $HotelInfoMenusToJson(HotelInfoMenus entity) {
  78. final Map<String, dynamic> data = <String, dynamic>{};
  79. data['key'] = entity.key;
  80. data['name'] = entity.name;
  81. data['children'] = entity.children?.map((v) => v.toJson()).toList();
  82. return data;
  83. }
  84. extension HotelInfoMenusExtension on HotelInfoMenus {
  85. HotelInfoMenus copyWith({
  86. String? key,
  87. String? name,
  88. List<HotelInfoMenusChildren>? children,
  89. }) {
  90. return HotelInfoMenus()
  91. ..key = key ?? this.key
  92. ..name = name ?? this.name
  93. ..children = children ?? this.children;
  94. }
  95. }
  96. HotelInfoMenusChildren $HotelInfoMenusChildrenFromJson(Map<String, dynamic> json) {
  97. final HotelInfoMenusChildren hotelInfoMenusChildren = HotelInfoMenusChildren();
  98. final String? key = jsonConvert.convert<String>(json['key']);
  99. if (key != null) {
  100. hotelInfoMenusChildren.key = key;
  101. }
  102. final String? name = jsonConvert.convert<String>(json['name']);
  103. if (name != null) {
  104. hotelInfoMenusChildren.name = name;
  105. }
  106. return hotelInfoMenusChildren;
  107. }
  108. Map<String, dynamic> $HotelInfoMenusChildrenToJson(HotelInfoMenusChildren entity) {
  109. final Map<String, dynamic> data = <String, dynamic>{};
  110. data['key'] = entity.key;
  111. data['name'] = entity.name;
  112. return data;
  113. }
  114. extension HotelInfoMenusChildrenExtension on HotelInfoMenusChildren {
  115. HotelInfoMenusChildren copyWith({
  116. String? key,
  117. String? name,
  118. }) {
  119. return HotelInfoMenusChildren()
  120. ..key = key ?? this.key
  121. ..name = name ?? this.name;
  122. }
  123. }