123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- import 'package:domain/generated/json/base/json_convert_content.dart';
- import 'package:domain/entity/response/hotel_info_entity.dart';
- HotelInfoEntity $HotelInfoEntityFromJson(Map<String, dynamic> json) {
- final HotelInfoEntity hotelInfoEntity = HotelInfoEntity();
- final int? adminId = jsonConvert.convert<int>(json['admin_id']);
- if (adminId != null) {
- hotelInfoEntity.adminId = adminId;
- }
- final String? name = jsonConvert.convert<String>(json['name']);
- if (name != null) {
- hotelInfoEntity.name = name;
- }
- final int? hotelId = jsonConvert.convert<int>(json['hotel_id']);
- if (hotelId != null) {
- hotelInfoEntity.hotelId = hotelId;
- }
- final String? hotelName = jsonConvert.convert<String>(json['hotel_name']);
- if (hotelName != null) {
- hotelInfoEntity.hotelName = hotelName;
- }
- final List<HotelInfoMenus>? menus = (json['menus'] as List<dynamic>?)?.map(
- (e) => jsonConvert.convert<HotelInfoMenus>(e) as HotelInfoMenus).toList();
- if (menus != null) {
- hotelInfoEntity.menus = menus;
- }
- final String? token = jsonConvert.convert<String>(json['token']);
- if (token != null) {
- hotelInfoEntity.token = token;
- }
- return hotelInfoEntity;
- }
- Map<String, dynamic> $HotelInfoEntityToJson(HotelInfoEntity entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['admin_id'] = entity.adminId;
- data['name'] = entity.name;
- data['hotel_id'] = entity.hotelId;
- data['hotel_name'] = entity.hotelName;
- data['menus'] = entity.menus?.map((v) => v.toJson()).toList();
- data['token'] = entity.token;
- return data;
- }
- extension HotelInfoEntityExtension on HotelInfoEntity {
- HotelInfoEntity copyWith({
- int? adminId,
- String? name,
- int? hotelId,
- String? hotelName,
- List<HotelInfoMenus>? menus,
- String? token,
- }) {
- return HotelInfoEntity()
- ..adminId = adminId ?? this.adminId
- ..name = name ?? this.name
- ..hotelId = hotelId ?? this.hotelId
- ..hotelName = hotelName ?? this.hotelName
- ..menus = menus ?? this.menus
- ..token = token ?? this.token;
- }
- }
- HotelInfoMenus $HotelInfoMenusFromJson(Map<String, dynamic> json) {
- final HotelInfoMenus hotelInfoMenus = HotelInfoMenus();
- final String? key = jsonConvert.convert<String>(json['key']);
- if (key != null) {
- hotelInfoMenus.key = key;
- }
- final String? name = jsonConvert.convert<String>(json['name']);
- if (name != null) {
- hotelInfoMenus.name = name;
- }
- final List<HotelInfoMenusChildren>? children = (json['children'] as List<dynamic>?)?.map(
- (e) => jsonConvert.convert<HotelInfoMenusChildren>(e) as HotelInfoMenusChildren).toList();
- if (children != null) {
- hotelInfoMenus.children = children;
- }
- return hotelInfoMenus;
- }
- Map<String, dynamic> $HotelInfoMenusToJson(HotelInfoMenus entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['key'] = entity.key;
- data['name'] = entity.name;
- data['children'] = entity.children?.map((v) => v.toJson()).toList();
- return data;
- }
- extension HotelInfoMenusExtension on HotelInfoMenus {
- HotelInfoMenus copyWith({
- String? key,
- String? name,
- List<HotelInfoMenusChildren>? children,
- }) {
- return HotelInfoMenus()
- ..key = key ?? this.key
- ..name = name ?? this.name
- ..children = children ?? this.children;
- }
- }
- HotelInfoMenusChildren $HotelInfoMenusChildrenFromJson(Map<String, dynamic> json) {
- final HotelInfoMenusChildren hotelInfoMenusChildren = HotelInfoMenusChildren();
- final String? key = jsonConvert.convert<String>(json['key']);
- if (key != null) {
- hotelInfoMenusChildren.key = key;
- }
- final String? name = jsonConvert.convert<String>(json['name']);
- if (name != null) {
- hotelInfoMenusChildren.name = name;
- }
- return hotelInfoMenusChildren;
- }
- Map<String, dynamic> $HotelInfoMenusChildrenToJson(HotelInfoMenusChildren entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['key'] = entity.key;
- data['name'] = entity.name;
- return data;
- }
- extension HotelInfoMenusChildrenExtension on HotelInfoMenusChildren {
- HotelInfoMenusChildren copyWith({
- String? key,
- String? name,
- }) {
- return HotelInfoMenusChildren()
- ..key = key ?? this.key
- ..name = name ?? this.name;
- }
- }
|