6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 43f89080

AuthorMikkel Thygesen<mikkelet@gmail.com>
Date2026-02-24 10:10:08 +0100
2777: cleaned up impl

Changed files

comwell_key_app/lib/data/remote/msal_service.dart  |  17 +-
 .../lib/overview/cubit/overview_cubit.dart         |   2 +-
 .../screens/concierge/concierge_route.dart         |  44 ++---
 comwell_key_app/lib/routing/app_router.dart        |   3 +-
 concierge/analysis_options.yaml                    |   2 +
 concierge/example/lib/main.dart                    |  59 +------
 concierge/example/test/widget_test.dart            |   5 +-
 .../data/remote/api/concierge_service.g.dart       | 184 +++++++++++++++++++--
 .../data/remote/models/api_response.g.dart         |  12 ++
 .../data/remote/models/area_category.g.dart        |  22 +++
 .../data/remote/models/area_category_dto.g.dart    |  24 ---
 .../data/remote/models/area_details.g.dart         |  71 ++++++++
 .../data/remote/models/area_details_dto.g.dart     |  60 -------
 .../data/remote/models/area_sub_category.g.dart    |  32 ++++
 .../remote/models/area_sub_category_dto.g.dart     |  32 ----
 .../remote/models/get_area_response_dto.g.dart     |  14 --
 .../remote/models/get_property_response.g.dart     |  16 ++
 .../remote/models/get_property_response_dto.g.dart |  18 --
 .../data/remote/models/media_image.g.dart          |  24 +++
 .../data/remote/models/media_image_dto.g.dart      |  24 ---
 .../lib/_generated/data/remote/models/order.g.dart | 155 +++++++++++++++++
 .../data/remote/models/order_review.g.dart         |  45 +++++
 .../_generated/data/remote/models/product.g.dart   |  73 ++++++++
 .../_generated/data/remote/models/promotion.g.dart |  19 +++
 .../data/remote/models/promotion_dto.g.dart        |  17 --
 .../_generated/data/remote/models/property.g.dart  |  59 +++++++
 .../data/remote/models/property_area.g.dart        |  59 +++++++
 .../data/remote/models/property_area_dto.g.dart    |  48 ------
 .../data/remote/models/property_dto.g.dart         |  63 -------
 .../data/remote/models/property_event.g.dart       |  26 +++
 .../data/remote/models/property_event_dto.g.dart   |  26 ---
 .../data/remote/models/property_intro.g.dart       |  26 +++
 .../data/remote/models/property_intro_dto.g.dart   |  26 ---
 .../data/remote/models/reject_message.g.dart       |  13 ++
 .../data/remote/models/reject_message_dto.g.dart   |  15 --
 .../bloc/hotel_overview_page_state.freezed.dart    |  59 ++++---
 concierge/lib/concierge.dart                       |  53 ------
 concierge/lib/concierge_app.dart                   | 113 +++++++++++++
 .../lib/data/remote/api/concierge_interceptor.dart |  17 ++
 .../lib/data/remote/api/concierge_service.dart     |  51 +++---
 .../lib/data/remote/converters/flag_converter.dart |  17 ++
 concierge/lib/data/remote/models/api_response.dart |  13 ++
 .../lib/data/remote/models/area_category.dart      |  25 +++
 .../lib/data/remote/models/area_category_dto.dart  |  26 ---
 concierge/lib/data/remote/models/area_details.dart |  64 +++++++
 .../lib/data/remote/models/area_details_dto.dart   |  75 ---------
 .../lib/data/remote/models/area_sub_category.dart  |  33 ++++
 .../data/remote/models/area_sub_category_dto.dart  |  38 -----
 .../lib/data/remote/models/get_area_response.dart  |   0
 .../data/remote/models/get_area_response_dto.dart  |  19 ---
 .../data/remote/models/get_property_response.dart  |  13 ++
 .../remote/models/get_property_response_dto.dart   |  19 ---
 concierge/lib/data/remote/models/media_image.dart  |  27 +++
 .../lib/data/remote/models/media_image_dto.dart    |  28 ----
 concierge/lib/data/remote/models/order.dart        | 182 ++++++++++++++++++++
 concierge/lib/data/remote/models/order_review.dart |  43 +++++
 concierge/lib/data/remote/models/product.dart      |  81 +++++++++
 concierge/lib/data/remote/models/promotion.dart    |  15 ++
 .../lib/data/remote/models/promotion_dto.dart      |  20 ---
 concierge/lib/data/remote/models/property.dart     |  54 ++++++
 .../lib/data/remote/models/property_area.dart      |  54 ++++++
 .../lib/data/remote/models/property_area_dto.dart  |  59 -------
 concierge/lib/data/remote/models/property_dto.dart |  61 -------
 .../lib/data/remote/models/property_event.dart     |  29 ++++
 .../lib/data/remote/models/property_event_dto.dart |  32 ----
 .../lib/data/remote/models/property_intro.dart     |  29 ++++
 .../lib/data/remote/models/property_intro_dto.dart |  30 ----
 .../lib/data/remote/models/reject_message.dart     |  15 ++
 .../lib/data/remote/models/reject_message_dto.dart |  18 --
 .../repositories/property_repository_impl.dart     |  18 --
 concierge/lib/di/getit.dart                        |  98 -----------
 .../lib/domain/mappers/area_details_mapper.dart    |  99 -----------
 concierge/lib/domain/mappers/property_mapper.dart  | 106 ------------
 concierge/lib/domain/models/app_error.dart         |  19 +++
 concierge/lib/domain/models/area_category.dart     |  15 --
 concierge/lib/domain/models/area_details.dart      |  50 ------
 concierge/lib/domain/models/area_sub_category.dart |  23 ---
 concierge/lib/domain/models/data_state.dart        |  33 ++++
 concierge/lib/domain/models/media_image.dart       |  17 --
 concierge/lib/domain/models/promotion.dart         |   8 -
 concierge/lib/domain/models/property.dart          |  42 -----
 concierge/lib/domain/models/property_area.dart     |  39 -----
 concierge/lib/domain/models/property_event.dart    |  19 ---
 concierge/lib/domain/models/property_intro.dart    |  19 ---
 concierge/lib/domain/models/reject_message.dart    |   8 -
 .../domain/repositories/property_repository.dart   |  67 +++++++-
 concierge/lib/flavors.dart                         |  17 +-
 .../presentation/app/concierge_hotel_overview.dart |  42 -----
 .../lib/presentation/navigation/app_routes.dart    |  10 +-
 concierge/lib/presentation/navigation/router.dart  |  14 +-
 .../bloc/hotel_overview_page_cubit.dart            |  58 +++++--
 .../bloc/hotel_overview_page_state.dart            |   8 +-
 .../hotel_overview_page_route.dart                 |  12 +-
 .../hotel_overview_page_screen.dart                |  34 ++--
 .../widgets/hotel_overview_app_bar.dart            |  35 ++--
 95 files changed, 1979 insertions(+), 1678 deletions(-)

Diff

diff --git a/comwell_key_app/lib/data/remote/msal_service.dart b/comwell_key_app/lib/data/remote/msal_service.dart
index 68b5da6b..b35d3468 100644
--- a/comwell_key_app/lib/data/remote/msal_service.dart
+++ b/comwell_key_app/lib/data/remote/msal_service.dart
@@ -57,12 +57,17 @@ class MSALService {
}
Future<String> acquireTokenSilent() async {
- final response = await msAuth.acquireTokenSilent(
- scopes: scopes,
- authority: authorityUrl,
- );
- await _comwellPreferences.setIsLoggedIn(true);
- return response.accessToken;
+ try {
+ final response = await msAuth.acquireTokenSilent(
+ scopes: scopes,
+ authority: authorityUrl,
+ );
+ await _comwellPreferences.setIsLoggedIn(true);
+ return response.accessToken;
+ } catch (e, st) {
+ await logout();
+ rethrow;
+ }
}
Future<void> logout() async {
diff --git a/comwell_key_app/lib/overview/cubit/overview_cubit.dart b/comwell_key_app/lib/overview/cubit/overview_cubit.dart
index 743332c7..940d7611 100644
--- a/comwell_key_app/lib/overview/cubit/overview_cubit.dart
+++ b/comwell_key_app/lib/overview/cubit/overview_cubit.dart
@@ -22,8 +22,8 @@ class OverviewCubit extends BaseCubit<OverviewState> {
try {
safeEmit(state.copyWith(isLoading: true));
final bookings = await _overviewRepository.fetchAllBookingsForUser();
- safeEmit(state.copyWith(bookings: bookings));
_bookingsLoaded = true;
+ safeEmit(state.copyWith(bookings: bookings));
} catch (e, st) {
logError(e, st);
safeEmit(state.copyWith(errorType: OverviewStateError.error));
diff --git a/comwell_key_app/lib/presentation/screens/concierge/concierge_route.dart b/comwell_key_app/lib/presentation/screens/concierge/concierge_route.dart
index b7d81fd6..e11edd70 100644
--- a/comwell_key_app/lib/presentation/screens/concierge/concierge_route.dart
+++ b/comwell_key_app/lib/presentation/screens/concierge/concierge_route.dart
@@ -1,14 +1,12 @@
-import 'package:comwell_key_app/presentation/screens/concierge/bloc/concierge_state.dart';
+import 'package:comwell_key_app/data/remote/msal_service.dart';
+import 'package:comwell_key_app/presentation/screens/login/login_route.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:comwell_key_app/utils/locator.dart';
-import 'package:concierge/concierge_config.dart';
-import 'package:concierge/flavors.dart';
-import 'package:concierge/presentation/app/concierge_hotel_overview.dart';
+import 'package:concierge/concierge_app.dart';
import 'package:flutter/material.dart';
-import 'package:flutter_bloc/flutter_bloc.dart';
+import 'package:flutter/services.dart';
import 'package:go_router/go_router.dart';
import 'package:comwell_key_app/presentation/navigation/transitions/slide_in_transition.dart';
-import 'package:comwell_key_app/presentation/screens/concierge/bloc/concierge_cubit.dart';
part '../../../.generated/presentation/screens/concierge/concierge_route.g.dart';
@@ -22,21 +20,29 @@ class ConciergeRoute extends GoRouteData with $ConciergeRoute {
@override
Page<void> buildPage(BuildContext context, GoRouterState state) {
+ final msalService = locator<MSALService>();
return SlideInTransition(
state: state,
- child: BlocProvider(
- create: (context) => ConciergeCubit(locator()),
- child: BlocBuilder<ConciergeCubit, ConciergeState>(
- builder: (context, state) {
- return ConciergeHotelOverview(
- config: ConciergeConfig(
- hotelCode: hotelCode,
- flavor: Flavor.production,
- userToken: state.userToken,
- ),
- );
- },
- ),
+ child: FutureBuilder(
+ future: msalService.acquireTokenSilent(),
+ builder: (context, asyncSnapshot) {
+ if (!asyncSnapshot.hasData) {
+ return const CircularProgressIndicator();
+ }
+ if (asyncSnapshot.hasError) {
+ msalService.logout();
+ LoginRoute().go(context);
+ print("qqq ${asyncSnapshot.error}");
+ print("qqq ${asyncSnapshot.stackTrace}");
+ return Text("${asyncSnapshot.error}");
+ }
+
+ return ConciergeApp(
+ authToken: asyncSnapshot.requireData,
+ flavor: appFlavor!,
+ hotelCode: hotelCode,
+ );
+ },
),
);
}
diff --git a/comwell_key_app/lib/routing/app_router.dart b/comwell_key_app/lib/routing/app_router.dart
index dc658ebb..e44022e3 100644
--- a/comwell_key_app/lib/routing/app_router.dart
+++ b/comwell_key_app/lib/routing/app_router.dart
@@ -27,6 +27,7 @@ import 'package:comwell_key_app/routing/go_router_observer.dart';
import 'package:comwell_key_app/share/share_booking_route.dart';
import 'package:comwell_key_app/up_sales/up_sales_route.dart';
import 'package:comwell_key_app/utils/context_utils.dart';
+import 'package:concierge/presentation/screens/hotel_overview_page/hotel_overview_page_route.dart';
import 'package:go_router/go_router.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
@@ -86,10 +87,10 @@ final router = GoRouter(
$permissionOverviewRoute,
$profileSettingsRoute,
$profileRoute,
- $conciergeRoute,
$paymentCardsRoute,
$paymentProcessingRoute,
$receivedSharedBookingRoute,
+ $conciergeRoute,
overviewRoute,
changePasswordRoute,
webviewRoute,
diff --git a/concierge/analysis_options.yaml b/concierge/analysis_options.yaml
index a5744c1c..366ecc80 100644
--- a/concierge/analysis_options.yaml
+++ b/concierge/analysis_options.yaml
@@ -2,3 +2,5 @@ include: package:flutter_lints/flutter.yaml
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
+formatter:
+ trailing_commas: preserve
\ No newline at end of file
diff --git a/concierge/example/lib/main.dart b/concierge/example/lib/main.dart
index f6efaee7..b4654adc 100644
--- a/concierge/example/lib/main.dart
+++ b/concierge/example/lib/main.dart
@@ -1,59 +1,4 @@
-import 'package:concierge/concierge.dart';
+import 'package:concierge/concierge_app.dart';
import 'package:flutter/material.dart';
-import 'package:go_router/go_router.dart';
-void main() => runApp(const MyApp());
-
-final _router = GoRouter(
- routes: [
- GoRoute(
- path: '/',
- builder: (context, state) => const HomePage(),
- ),
- GoRoute(
- path: '/concierge/:hotelCode',
- builder: (context, state) => Concierge.hotelOverview(
- flavor: Flavor.production,
- hotelCode: state.pathParameters['hotelCode']!,
- userToken: 'example-token',
- ),
- ),
- ],
-);
-
-class MyApp extends StatelessWidget {
- const MyApp({super.key});
-
- @override
- Widget build(BuildContext context) {
- return MaterialApp.router(
- routerConfig: _router,
- );
- }
-}
-
-class HomePage extends StatelessWidget {
- const HomePage({super.key});
-
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(title: const Text('Concierge example (GoRouter)')),
- body: Center(
- child: InkWell(
- onTap: () => context.push('/concierge/cso'),
- child: Container(
- width: 220,
- height: 120,
- alignment: Alignment.center,
- decoration: BoxDecoration(
- color: Colors.black12,
- borderRadius: BorderRadius.circular(16),
- ),
- child: const Text('Tap image button → open concierge'),
- ),
- ),
- ),
- );
- }
-}
+void main() => runApp(ConciergeApp(flavor: "", authToken: "", hotelCode: ""));
diff --git a/concierge/example/test/widget_test.dart b/concierge/example/test/widget_test.dart
index c73079fe..d37441e9 100644
--- a/concierge/example/test/widget_test.dart
+++ b/concierge/example/test/widget_test.dart
@@ -5,15 +5,14 @@
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
+import 'package:concierge/concierge_app.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
-import 'package:concierge_example/main.dart';
-
void main() {
testWidgets('Verify Platform version', (WidgetTester tester) async {
// Build our app and trigger a frame.
- await tester.pumpWidget(const MyApp());
+ await tester.pumpWidget(ConciergeApp(authToken: "authToken", flavor: "flavor", hotelCode: "",));
// Verify that platform version is retrieved.
expect(
diff --git a/concierge/lib/_generated/data/remote/api/concierge_service.g.dart b/concierge/lib/_generated/data/remote/api/concierge_service.g.dart
index 35291432..8102688b 100644
--- a/concierge/lib/_generated/data/remote/api/concierge_service.g.dart
+++ b/concierge/lib/_generated/data/remote/api/concierge_service.g.dart
@@ -20,25 +20,28 @@ class _ConciergeService implements ConciergeService {
final ParseErrorLogger? errorLogger;
@override
- Future<GetPropertyResponseDto> getHotelOverview(String hotelcode) async {
+ Future<ApiResponse<Property>> getHotelOverview(String hotelCode) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
- final _options = _setStreamType<GetPropertyResponseDto>(
+ final _options = _setStreamType<ApiResponse<Property>>(
Options(method: 'GET', headers: _headers, extra: _extra)
.compose(
_dio.options,
- '/hotels/domains/${hotelcode}',
+ '/hotels/domains/${hotelCode}',
queryParameters: queryParameters,
data: _data,
)
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
);
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
- late GetPropertyResponseDto _value;
+ late ApiResponse<Property> _value;
try {
- _value = GetPropertyResponseDto.fromJson(_result.data!);
+ _value = ApiResponse<Property>.fromJson(
+ _result.data!,
+ (json) => Property.fromJson(json as Map<String, dynamic>),
+ );
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options, response: _result);
rethrow;
@@ -47,25 +50,186 @@ class _ConciergeService implements ConciergeService {
}
@override
- Future<GetAreaResponseDto> getArea(String areaid) async {
+ Future<ApiResponse<AreaDetails>> getArea(int areaId) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
- final _options = _setStreamType<GetAreaResponseDto>(
+ final _options = _setStreamType<ApiResponse<AreaDetails>>(
Options(method: 'GET', headers: _headers, extra: _extra)
.compose(
_dio.options,
- '/areas/${areaid}',
+ '/areas/${areaId}',
queryParameters: queryParameters,
data: _data,
)
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
);
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
- late GetAreaResponseDto _value;
+ late ApiResponse<AreaDetails> _value;
try {
- _value = GetAreaResponseDto.fromJson(_result.data!);
+ _value = ApiResponse<AreaDetails>.fromJson(
+ _result.data!,
+ (json) => AreaDetails.fromJson(json as Map<String, dynamic>),
+ );
+ } on Object catch (e, s) {
+ errorLogger?.logError(e, s, _options, response: _result);
+ rethrow;
+ }
+ return _value;
+ }
+
+ @override
+ Future<ApiResponse<Product>> getProduct(String productid) async {
+ final _extra = <String, dynamic>{};
+ final queryParameters = <String, dynamic>{};
+ final _headers = <String, dynamic>{};
+ const Map<String, dynamic>? _data = null;
+ final _options = _setStreamType<ApiResponse<Product>>(
+ Options(method: 'GET', headers: _headers, extra: _extra)
+ .compose(
+ _dio.options,
+ '/products/${productid}',
+ queryParameters: queryParameters,
+ data: _data,
+ )
+ .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
+ );
+ final _result = await _dio.fetch<Map<String, dynamic>>(_options);
+ late ApiResponse<Product> _value;
+ try {
+ _value = ApiResponse<Product>.fromJson(
+ _result.data!,
+ (json) => Product.fromJson(json as Map<String, dynamic>),
+ );
+ } on Object catch (e, s) {
+ errorLogger?.logError(e, s, _options, response: _result);
+ rethrow;
+ }
+ return _value;
+ }
+
+ @override
+ Future<ApiResponse<OrderReview>> getOrderReview(
+ Map<String, dynamic> body,
+ ) async {
+ final _extra = <String, dynamic>{};
+ final queryParameters = <String, dynamic>{};
+ final _headers = <String, dynamic>{};
+ final _data = <String, dynamic>{};
+ _data.addAll(body);
+ final _options = _setStreamType<ApiResponse<OrderReview>>(
+ Options(method: 'POST', headers: _headers, extra: _extra)
+ .compose(
+ _dio.options,
+ '/orders/review',
+ queryParameters: queryParameters,
+ data: _data,
+ )
+ .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
+ );
+ final _result = await _dio.fetch<Map<String, dynamic>>(_options);
+ late ApiResponse<OrderReview> _value;
+ try {
+ _value = ApiResponse<OrderReview>.fromJson(
+ _result.data!,
+ (json) => OrderReview.fromJson(json as Map<String, dynamic>),
+ );
+ } on Object catch (e, s) {
+ errorLogger?.logError(e, s, _options, response: _result);
+ rethrow;
+ }
+ return _value;
+ }
+
+ @override
+ Future<ApiResponse<Order>> createOrder(Map<String, dynamic> body) async {
+ final _extra = <String, dynamic>{};
+ final queryParameters = <String, dynamic>{};
+ final _headers = <String, dynamic>{};
+ final _data = <String, dynamic>{};
+ _data.addAll(body);
+ final _options = _setStreamType<ApiResponse<Order>>(
+ Options(method: 'POST', headers: _headers, extra: _extra)
+ .compose(
+ _dio.options,
+ '/orders/',
+ queryParameters: queryParameters,
+ data: _data,
+ )
+ .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
+ );
+ final _result = await _dio.fetch<Map<String, dynamic>>(_options);
+ late ApiResponse<Order> _value;
+ try {
+ _value = ApiResponse<Order>.fromJson(
+ _result.data!,
+ (json) => Order.fromJson(json as Map<String, dynamic>),
+ );
+ } on Object catch (e, s) {
+ errorLogger?.logError(e, s, _options, response: _result);
+ rethrow;
+ }
+ return _value;
+ }
+
+ @override
+ Future<ApiResponse<Order>> getOrder(String orderId) async {
+ final _extra = <String, dynamic>{};
+ final queryParameters = <String, dynamic>{};
+ final _headers = <String, dynamic>{};
+ const Map<String, dynamic>? _data = null;
+ final _options = _setStreamType<ApiResponse<Order>>(
+ Options(method: 'GET', headers: _headers, extra: _extra)
+ .compose(
+ _dio.options,
+ '/orders/${orderId}',
+ queryParameters: queryParameters,
+ data: _data,
+ )
+ .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
+ );
+ final _result = await _dio.fetch<Map<String, dynamic>>(_options);
+ late ApiResponse<Order> _value;
+ try {
+ _value = ApiResponse<Order>.fromJson(
+ _result.data!,
+ (json) => Order.fromJson(json as Map<String, dynamic>),
+ );
+ } on Object catch (e, s) {
+ errorLogger?.logError(e, s, _options, response: _result);
+ rethrow;
+ }
+ return _value;
+ }
+
+ @override
+ Future<ApiResponse<List<Order>>> getCustomerOrders() async {
+ final _extra = <String, dynamic>{};
+ final queryParameters = <String, dynamic>{};
+ final _headers = <String, dynamic>{};
+ const Map<String, dynamic>? _data = null;
+ final _options = _setStreamType<ApiResponse<List<Order>>>(
+ Options(method: 'GET', headers: _headers, extra: _extra)
+ .compose(
+ _dio.options,
+ '/customers/me/orders',
+ queryParameters: queryParameters,
+ data: _data,
+ )
+ .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
+ );
+ final _result = await _dio.fetch<Map<String, dynamic>>(_options);
+ late ApiResponse<List<Order>> _value;
+ try {
+ _value = ApiResponse<List<Order>>.fromJson(
+ _result.data!,
+ (json) => json is List<dynamic>
+ ? json
+ .map<Order>((i) => Order.fromJson(i as Map<String, dynamic>))
+ .toList()
+ : List.empty(),
+ );
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options, response: _result);
rethrow;
diff --git a/concierge/lib/_generated/data/remote/models/api_response.g.dart b/concierge/lib/_generated/data/remote/models/api_response.g.dart
new file mode 100644
index 00000000..528f108e
--- /dev/null
+++ b/concierge/lib/_generated/data/remote/models/api_response.g.dart
@@ -0,0 +1,12 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of '../../../../data/remote/models/api_response.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+ApiResponse<T> _$ApiResponseFromJson<T>(
+ Map json,
+ T Function(Object? json) fromJsonT,
+) => ApiResponse<T>(data: fromJsonT(json['data']));
diff --git a/concierge/lib/_generated/data/remote/models/area_category.g.dart b/concierge/lib/_generated/data/remote/models/area_category.g.dart
new file mode 100644
index 00000000..9a3460a1
--- /dev/null
+++ b/concierge/lib/_generated/data/remote/models/area_category.g.dart
@@ -0,0 +1,22 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of '../../../../data/remote/models/area_category.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+AreaCategory _$AreaCategoryFromJson(Map json) => AreaCategory(
+ id: (json['id'] as num).toInt(),
+ name: json['name'] as String,
+ subCategories: (json['sub_categories'] as List<dynamic>)
+ .map((e) => AreaSubCategory.fromJson(Map<String, dynamic>.from(e as Map)))
+ .toList(),
+);
+
+Map<String, dynamic> _$AreaCategoryToJson(AreaCategory instance) =>
+ <String, dynamic>{
+ 'id': instance.id,
+ 'name': instance.name,
+ 'sub_categories': instance.subCategories.map((e) => e.toJson()).toList(),
+ };
diff --git a/concierge/lib/_generated/data/remote/models/area_category_dto.g.dart b/concierge/lib/_generated/data/remote/models/area_category_dto.g.dart
deleted file mode 100644
index d614c2f6..00000000
--- a/concierge/lib/_generated/data/remote/models/area_category_dto.g.dart
+++ /dev/null
@@ -1,24 +0,0 @@
-// GENERATED CODE - DO NOT MODIFY BY HAND
-
-part of '../../../../data/remote/models/area_category_dto.dart';
-
-// **************************************************************************
-// JsonSerializableGenerator
-// **************************************************************************
-
-AreaCategoryDto _$AreaCategoryDtoFromJson(Map json) => AreaCategoryDto(
- id: (json['id'] as num).toInt(),
- name: json['name'] as String,
- subCategories: (json['sub_categories'] as List<dynamic>)
- .map(
- (e) => AreaSubCategoryDto.fromJson(Map<String, dynamic>.from(e as Map)),
- )
- .toList(),
-);
-
-Map<String, dynamic> _$AreaCategoryDtoToJson(AreaCategoryDto instance) =>
- <String, dynamic>{
- 'id': instance.id,
- 'name': instance.name,
- 'sub_categories': instance.subCategories.map((e) => e.toJson()).toList(),
- };
diff --git a/concierge/lib/_generated/data/remote/models/area_details.g.dart b/concierge/lib/_generated/data/remote/models/area_details.g.dart
new file mode 100644
index 00000000..d63adcf0
--- /dev/null
+++ b/concierge/lib/_generated/data/remote/models/area_details.g.dart
@@ -0,0 +1,71 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of '../../../../data/remote/models/area_details.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+AreaDetails _$AreaDetailsFromJson(Map json) => AreaDetails(
+ id: (json['id'] as num).toInt(),
+ name: json['name'] as String,
+ pickupText: json['pickup_text'] as String,
+ deliveryText: json['delivery_text'] as String,
+ isOpen: const FlagConverter().fromJson((json['is_open'] as num).toInt()),
+ isMeetingArea: const FlagConverter().fromJson(
+ (json['is_meeting_area'] as num).toInt(),
+ ),
+ isGuestArea: const FlagConverter().fromJson(
+ (json['is_guest_area'] as num).toInt(),
+ ),
+ isPrearrivalArea: const FlagConverter().fromJson(
+ (json['is_prearrival_area'] as num).toInt(),
+ ),
+ theme: json['theme'] as String,
+ icon: json['icon'] as String,
+ deliveryPrice: (json['delivery_price'] as num?)?.toInt(),
+ isDeliveryDefault: const FlagConverter().fromJson(
+ (json['is_delivery_default'] as num).toInt(),
+ ),
+ hasDelivery: const FlagConverter().fromJson(
+ (json['has_delivery'] as num).toInt(),
+ ),
+ events: (json['events'] as List<dynamic>)
+ .map((e) => PropertyEvent.fromJson(Map<String, dynamic>.from(e as Map)))
+ .toList(),
+ skipLocation: json['skip_location'] as bool,
+ categories: (json['categories'] as List<dynamic>)
+ .map((e) => AreaCategory.fromJson(Map<String, dynamic>.from(e as Map)))
+ .toList(),
+ promotion: Promotion.fromJson(
+ Map<String, dynamic>.from(json['promotion'] as Map),
+ ),
+ deliveryTimes: json['delivery_times'] as List<dynamic>,
+ supportItems: json['support_items'] as List<dynamic>,
+);
+
+Map<String, dynamic> _$AreaDetailsToJson(
+ AreaDetails instance,
+) => <String, dynamic>{
+ 'id': instance.id,
+ 'name': instance.name,
+ 'pickup_text': instance.pickupText,
+ 'delivery_text': instance.deliveryText,
+ 'is_open': const FlagConverter().toJson(instance.isOpen),
+ 'is_meeting_area': const FlagConverter().toJson(instance.isMeetingArea),
+ 'is_guest_area': const FlagConverter().toJson(instance.isGuestArea),
+ 'is_prearrival_area': const FlagConverter().toJson(instance.isPrearrivalArea),
+ 'theme': instance.theme,
+ 'icon': instance.icon,
+ 'delivery_price': instance.deliveryPrice,
+ 'is_delivery_default': const FlagConverter().toJson(
+ instance.isDeliveryDefault,
+ ),
+ 'has_delivery': const FlagConverter().toJson(instance.hasDelivery),
+ 'events': instance.events.map((e) => e.toJson()).toList(),
+ 'skip_location': instance.skipLocation,
+ 'categories': instance.categories.map((e) => e.toJson()).toList(),
+ 'promotion': instance.promotion.toJson(),
+ 'delivery_times': instance.deliveryTimes,
+ 'support_items': instance.supportItems,
+};
diff --git a/concierge/lib/_generated/data/remote/models/area_details_dto.g.dart b/concierge/lib/_generated/data/remote/models/area_details_dto.g.dart
deleted file mode 100644
index b639ac62..00000000
--- a/concierge/lib/_generated/data/remote/models/area_details_dto.g.dart
+++ /dev/null
@@ -1,60 +0,0 @@
-// GENERATED CODE - DO NOT MODIFY BY HAND
-
-part of '../../../../data/remote/models/area_details_dto.dart';
-
-// **************************************************************************
-// JsonSerializableGenerator
-// **************************************************************************
-
-AreaDetailsDto _$AreaDetailsDtoFromJson(Map json) => AreaDetailsDto(
- id: (json['id'] as num).toInt(),
- name: json['name'] as String,
- pickupText: json['pickup_text'] as String,
- deliveryText: json['delivery_text'] as String,
- isOpen: (json['is_open'] as num).toInt(),
- isMeetingArea: (json['is_meeting_area'] as num).toInt(),
- isGuestArea: (json['is_guest_area'] as num).toInt(),
- isPrearrivalArea: (json['is_prearrival_area'] as num).toInt(),
- theme: json['theme'] as String,
- icon: json['icon'] as String,
- deliveryPrice: (json['delivery_price'] as num).toInt(),
- isDeliveryDefault: (json['is_delivery_default'] as num).toInt(),
- hasDelivery: (json['has_delivery'] as num).toInt(),
- events: (json['events'] as List<dynamic>)
- .map(
- (e) => PropertyEventDto.fromJson(Map<String, dynamic>.from(e as Map)),
- )
- .toList(),
- skipLocation: json['skip_location'] as bool,
- categories: (json['categories'] as List<dynamic>)
- .map((e) => AreaCategoryDto.fromJson(Map<String, dynamic>.from(e as Map)))
- .toList(),
- promotion: PromotionDto.fromJson(
- Map<String, dynamic>.from(json['promotion'] as Map),
- ),
- deliveryTimes: json['delivery_times'] as List<dynamic>,
- supportItems: json['support_items'] as List<dynamic>,
-);
-
-Map<String, dynamic> _$AreaDetailsDtoToJson(AreaDetailsDto instance) =>
- <String, dynamic>{
- 'id': instance.id,
- 'name': instance.name,
- 'pickup_text': instance.pickupText,
- 'delivery_text': instance.deliveryText,
- 'is_open': instance.isOpen,
- 'is_meeting_area': instance.isMeetingArea,
- 'is_guest_area': instance.isGuestArea,
- 'is_prearrival_area': instance.isPrearrivalArea,
- 'theme': instance.theme,
- 'icon': instance.icon,
- 'delivery_price': instance.deliveryPrice,
- 'is_delivery_default': instance.isDeliveryDefault,
- 'has_delivery': instance.hasDelivery,
- 'events': instance.events.map((e) => e.toJson()).toList(),
- 'skip_location': instance.skipLocation,
- 'categories': instance.categories.map((e) => e.toJson()).toList(),
- 'promotion': instance.promotion.toJson(),
- 'delivery_times': instance.deliveryTimes,
- 'support_items': instance.supportItems,
- };
diff --git a/concierge/lib/_generated/data/remote/models/area_sub_category.g.dart b/concierge/lib/_generated/data/remote/models/area_sub_category.g.dart
new file mode 100644
index 00000000..48f9f821
--- /dev/null
+++ b/concierge/lib/_generated/data/remote/models/area_sub_category.g.dart
@@ -0,0 +1,32 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of '../../../../data/remote/models/area_sub_category.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+AreaSubCategory _$AreaSubCategoryFromJson(Map json) => AreaSubCategory(
+ id: (json['id'] as num).toInt(),
+ name: json['name'] as String,
+ subTitle: json['sub_title'] as String,
+ heroTitle: json['hero_title'] as String,
+ description: json['description'] as String,
+ heroImage: MediaImage.fromJson(
+ Map<String, dynamic>.from(json['hero_image'] as Map),
+ ),
+ products: (json['products'] as List<dynamic>)
+ .map((e) => (e as num).toInt())
+ .toList(),
+);
+
+Map<String, dynamic> _$AreaSubCategoryToJson(AreaSubCategory instance) =>
+ <String, dynamic>{
+ 'id': instance.id,
+ 'name': instance.name,
+ 'sub_title': instance.subTitle,
+ 'hero_title': instance.heroTitle,
+ 'description': instance.description,
+ 'hero_image': instance.heroImage.toJson(),
+ 'products': instance.products,
+ };
diff --git a/concierge/lib/_generated/data/remote/models/area_sub_category_dto.g.dart b/concierge/lib/_generated/data/remote/models/area_sub_category_dto.g.dart
deleted file mode 100644
index 41479a9c..00000000
--- a/concierge/lib/_generated/data/remote/models/area_sub_category_dto.g.dart
+++ /dev/null
@@ -1,32 +0,0 @@
-// GENERATED CODE - DO NOT MODIFY BY HAND
-
-part of '../../../../data/remote/models/area_sub_category_dto.dart';
-
-// **************************************************************************
-// JsonSerializableGenerator
-// **************************************************************************
-
-AreaSubCategoryDto _$AreaSubCategoryDtoFromJson(Map json) => AreaSubCategoryDto(
- id: (json['id'] as num).toInt(),
- name: json['name'] as String,
- subTitle: json['sub_title'] as String,
- heroTitle: json['hero_title'] as String,
- description: json['description'] as String,
- heroImage: MediaImageDto.fromJson(
- Map<String, dynamic>.from(json['hero_image'] as Map),
- ),
- products: (json['products'] as List<dynamic>)
- .map((e) => (e as num).toInt())
- .toList(),
-);
-
-Map<String, dynamic> _$AreaSubCategoryDtoToJson(AreaSubCategoryDto instance) =>
- <String, dynamic>{
- 'id': instance.id,
- 'name': instance.name,
- 'sub_title': instance.subTitle,
- 'hero_title': instance.heroTitle,
- 'description': instance.description,
- 'hero_image': instance.heroImage.toJson(),
- 'products': instance.products,
- };
diff --git a/concierge/lib/_generated/data/remote/models/get_area_response_dto.g.dart b/concierge/lib/_generated/data/remote/models/get_area_response_dto.g.dart
deleted file mode 100644
index 6527ac18..00000000
--- a/concierge/lib/_generated/data/remote/models/get_area_response_dto.g.dart
+++ /dev/null
@@ -1,14 +0,0 @@
-// GENERATED CODE - DO NOT MODIFY BY HAND
-
-part of '../../../../data/remote/models/get_area_response_dto.dart';
-
-// **************************************************************************
-// JsonSerializableGenerator
-// **************************************************************************
-
-GetAreaResponseDto _$GetAreaResponseDtoFromJson(Map json) => GetAreaResponseDto(
- data: AreaDetailsDto.fromJson(Map<String, dynamic>.from(json['data'] as Map)),
-);
-
-Map<String, dynamic> _$GetAreaResponseDtoToJson(GetAreaResponseDto instance) =>
- <String, dynamic>{'data': instance.data.toJson()};
diff --git a/concierge/lib/_generated/data/remote/models/get_property_response.g.dart b/concierge/lib/_generated/data/remote/models/get_property_response.g.dart
new file mode 100644
index 00000000..9f0a544d
--- /dev/null
+++ b/concierge/lib/_generated/data/remote/models/get_property_response.g.dart
@@ -0,0 +1,16 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of '../../../../data/remote/models/get_property_response.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+GetPropertyResponse _$GetPropertyResponseFromJson(Map json) =>
+ GetPropertyResponse(
+ data: Property.fromJson(Map<String, dynamic>.from(json['data'] as Map)),
+ );
+
+Map<String, dynamic> _$GetPropertyResponseToJson(
+ GetPropertyResponse instance,
+) => <String, dynamic>{'data': instance.data.toJson()};
diff --git a/concierge/lib/_generated/data/remote/models/get_property_response_dto.g.dart b/concierge/lib/_generated/data/remote/models/get_property_response_dto.g.dart
deleted file mode 100644
index c2f532fd..00000000
--- a/concierge/lib/_generated/data/remote/models/get_property_response_dto.g.dart
+++ /dev/null
@@ -1,18 +0,0 @@
-// GENERATED CODE - DO NOT MODIFY BY HAND
-
-part of '../../../../data/remote/models/get_property_response_dto.dart';
-
-// **************************************************************************
-// JsonSerializableGenerator
-// **************************************************************************
-
-GetPropertyResponseDto _$GetPropertyResponseDtoFromJson(Map json) =>
- GetPropertyResponseDto(
- data: PropertyDto.fromJson(
- Map<String, dynamic>.from(json['data'] as Map),
- ),
- );
-
-Map<String, dynamic> _$GetPropertyResponseDtoToJson(
- GetPropertyResponseDto instance,
-) => <String, dynamic>{'data': instance.data.toJson()};
diff --git a/concierge/lib/_generated/data/remote/models/media_image.g.dart b/concierge/lib/_generated/data/remote/models/media_image.g.dart
new file mode 100644
index 00000000..f5bcfb2c
--- /dev/null
+++ b/concierge/lib/_generated/data/remote/models/media_image.g.dart
@@ -0,0 +1,24 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of '../../../../data/remote/models/media_image.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+MediaImage _$MediaImageFromJson(Map json) => MediaImage(
+ url: json['url'] as String,
+ preload: json['preload'] as String,
+ thumbnail: json['thumbnail'] as String,
+ productHero: json['product_hero'] as String,
+ alt: json['alt'] as String,
+);
+
+Map<String, dynamic> _$MediaImageToJson(MediaImage instance) =>
+ <String, dynamic>{
+ 'url': instance.url,
+ 'preload': instance.preload,
+ 'thumbnail': instance.thumbnail,
+ 'product_hero': instance.productHero,
+ 'alt': instance.alt,
+ };
diff --git a/concierge/lib/_generated/data/remote/models/media_image_dto.g.dart b/concierge/lib/_generated/data/remote/models/media_image_dto.g.dart
deleted file mode 100644
index 0d8c7691..00000000
--- a/concierge/lib/_generated/data/remote/models/media_image_dto.g.dart
+++ /dev/null
@@ -1,24 +0,0 @@
-// GENERATED CODE - DO NOT MODIFY BY HAND
-
-part of '../../../../data/remote/models/media_image_dto.dart';
-
-// **************************************************************************
-// JsonSerializableGenerator
-// **************************************************************************
-
-MediaImageDto _$MediaImageDtoFromJson(Map json) => MediaImageDto(
- url: json['url'] as String,
- preload: json['preload'] as String,
- thumbnail: json['thumbnail'] as String,
- productHero: json['product_hero'] as String,
- alt: json['alt'] as String,
-);
-
-Map<String, dynamic> _$MediaImageDtoToJson(MediaImageDto instance) =>
- <String, dynamic>{
- 'url': instance.url,
- 'preload': instance.preload,
- 'thumbnail': instance.thumbnail,
- 'product_hero': instance.productHero,
- 'alt': instance.alt,
- };
diff --git a/concierge/lib/_generated/data/remote/models/order.g.dart b/concierge/lib/_generated/data/remote/models/order.g.dart
new file mode 100644
index 00000000..d418e906
--- /dev/null
+++ b/concierge/lib/_generated/data/remote/models/order.g.dart
@@ -0,0 +1,155 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of '../../../../data/remote/models/order.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+Order _$OrderFromJson(Map json) => Order(
+ id: (json['id'] as num).toInt(),
+ status: json['status'] as String,
+ type: json['type'] as String,
+ isArchived: json['is_archived'] as bool,
+ archivedAt: json['archived_at'],
+ cancelReason: json['cancel_reason'],
+ totalPrice: (json['total_price'] as num).toInt(),
+ deliveryMethod: json['delivery_method'] as String,
+ requestedDeliveryTime: json['requested_delivery_time'] as String,
+ estimatedDeliveryTime: json['estimated_delivery_time'],
+ pickupLocation: json['pickup_location'],
+ areaId: (json['area_id'] as num).toInt(),
+ locationId: (json['location_id'] as num).toInt(),
+ createdAt: DateTime.parse(json['created_at'] as String),
+ updatedAt: DateTime.parse(json['updated_at'] as String),
+ customerComment: json['customer_comment'],
+ delivery: json['delivery'] as bool,
+ deliveryPrice: (json['delivery_price'] as num).toInt(),
+ deliveryMethodString: json['delivery_method_string'] as String,
+ statusString: json['status_string'] as String,
+ typeString: json['type_string'] as String,
+ locationCode: json['location_code'] as String,
+ orderItems: (json['order_items'] as List<dynamic>)
+ .map((e) => OrderItem.fromJson(Map<String, dynamic>.from(e as Map)))
+ .toList(),
+ payment: Payment.fromJson(Map<String, dynamic>.from(json['payment'] as Map)),
+ customer: Customer.fromJson(
+ Map<String, dynamic>.from(json['customer'] as Map),
+ ),
+ lastUpdateFrom: json['last_update_from'],
+ image: Image.fromJson(Map<String, dynamic>.from(json['image'] as Map)),
+);
+
+Map<String, dynamic> _$OrderToJson(Order instance) => <String, dynamic>{
+ 'id': instance.id,
+ 'status': instance.status,
+ 'type': instance.type,
+ 'is_archived': instance.isArchived,
+ 'archived_at': instance.archivedAt,
+ 'cancel_reason': instance.cancelReason,
+ 'total_price': instance.totalPrice,
+ 'delivery_method': instance.deliveryMethod,
+ 'requested_delivery_time': instance.requestedDeliveryTime,
+ 'estimated_delivery_time': instance.estimatedDeliveryTime,
+ 'pickup_location': instance.pickupLocation,
+ 'area_id': instance.areaId,
+ 'location_id': instance.locationId,
+ 'created_at': instance.createdAt.toIso8601String(),
+ 'updated_at': instance.updatedAt.toIso8601String(),
+ 'customer_comment': instance.customerComment,
+ 'delivery': instance.delivery,
+ 'delivery_price': instance.deliveryPrice,
+ 'delivery_method_string': instance.deliveryMethodString,
+ 'status_string': instance.statusString,
+ 'type_string': instance.typeString,
+ 'location_code': instance.locationCode,
+ 'order_items': instance.orderItems.map((e) => e.toJson()).toList(),
+ 'payment': instance.payment.toJson(),
+ 'customer': instance.customer.toJson(),
+ 'last_update_from': instance.lastUpdateFrom,
+ 'image': instance.image.toJson(),
+};
+
+Customer _$CustomerFromJson(Map json) => Customer(
+ id: (json['id'] as num).toInt(),
+ firstName: json['first_name'] as String,
+ lastName: json['last_name'],
+ email: json['email'],
+ isComwellClub: (json['is_comwell_club'] as num).toInt(),
+ phone: json['phone'] as String,
+ phonePrefix: json['phone_prefix'] as String,
+);
+
+Map<String, dynamic> _$CustomerToJson(Customer instance) => <String, dynamic>{
+ 'id': instance.id,
+ 'first_name': instance.firstName,
+ 'last_name': instance.lastName,
+ 'email': instance.email,
+ 'is_comwell_club': instance.isComwellClub,
+ 'phone': instance.phone,
+ 'phone_prefix': instance.phonePrefix,
+};
+
+Image _$ImageFromJson(Map json) => Image(
+ url: json['url'] as String,
+ preload: json['preload'] as String,
+ thumbnail: json['thumbnail'] as String,
+ productHero: json['product_hero'] as String,
+ alt: json['alt'] as String,
+);
+
+Map<String, dynamic> _$ImageToJson(Image instance) => <String, dynamic>{
+ 'url': instance.url,
+ 'preload': instance.preload,
+ 'thumbnail': instance.thumbnail,
+ 'product_hero': instance.productHero,
+ 'alt': instance.alt,
+};
+
+OrderItem _$OrderItemFromJson(Map json) => OrderItem(
+ id: (json['id'] as num).toInt(),
+ price: (json['price'] as num).toInt(),
+ quantity: (json['quantity'] as num).toInt(),
+ itemType: json['item_type'] as String,
+ alternativeName: json['alternative_name'] as String,
+ productId: (json['product_id'] as num?)?.toInt(),
+ orderId: (json['order_id'] as num).toInt(),
+ options: json['options'] as List<dynamic>?,
+ itemTypeString: json['item_type_string'] as String,
+ vouchers: json['vouchers'] as List<dynamic>,
+ totalPrice: (json['total_price'] as num).toInt(),
+ totalPriceBeforeSavings: (json['total_price_before_savings'] as num).toInt(),
+);
+
+Map<String, dynamic> _$OrderItemToJson(OrderItem instance) => <String, dynamic>{
+ 'id': instance.id,
+ 'price': instance.price,
+ 'quantity': instance.quantity,
+ 'item_type': instance.itemType,
+ 'alternative_name': instance.alternativeName,
+ 'product_id': instance.productId,
+ 'order_id': instance.orderId,
+ 'options': instance.options,
+ 'item_type_string': instance.itemTypeString,
+ 'vouchers': instance.vouchers,
+ 'total_price': instance.totalPrice,
+ 'total_price_before_savings': instance.totalPriceBeforeSavings,
+};
+
+Payment _$PaymentFromJson(Map json) => Payment(
+ id: (json['id'] as num).toInt(),
+ paymentType: json['payment_type'] as String,
+ room: json['room'],
+ meeting: json['meeting'],
+ fullName: json['full_name'],
+ paymentTypeString: json['payment_type_string'] as String,
+);
+
+Map<String, dynamic> _$PaymentToJson(Payment instance) => <String, dynamic>{
+ 'id': instance.id,
+ 'payment_type': instance.paymentType,
+ 'room': instance.room,
+ 'meeting': instance.meeting,
+ 'full_name': instance.fullName,
+ 'payment_type_string': instance.paymentTypeString,
+};
diff --git a/concierge/lib/_generated/data/remote/models/order_review.g.dart b/concierge/lib/_generated/data/remote/models/order_review.g.dart
new file mode 100644
index 00000000..ae744ab6
--- /dev/null
+++ b/concierge/lib/_generated/data/remote/models/order_review.g.dart
@@ -0,0 +1,45 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of '../../../../data/remote/models/order_review.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+OrderReview _$OrderReviewFromJson(Map json) => OrderReview(
+ products: (json['products'] as List<dynamic>)
+ .map((e) => Product.fromJson(Map<String, dynamic>.from(e as Map)))
+ .toList(),
+ areaId: (json['area_id'] as num).toInt(),
+ locationCode: json['location_code'] as String,
+ delivery: json['delivery'] as bool,
+ requestedDeliveryTime: json['requested_delivery_time'] as String,
+ paymentType: json['payment_type'] as String,
+ fullName: json['full_name'] as String,
+ customerId: json['customer_id'] as String,
+ customerName: json['customer_name'] as String,
+ customerComment: json['customer_comment'] as String,
+ orderType: json['order_type'] as String,
+ deliveryPrice: (json['delivery_price'] as num).toDouble(),
+ totalPrice: (json['total_price'] as num).toDouble(),
+ totalPriceBeforeSavings: (json['total_price_before_savings'] as num)
+ .toDouble(),
+);
+
+Map<String, dynamic> _$OrderReviewToJson(OrderReview instance) =>
+ <String, dynamic>{
+ 'products': instance.products.map((e) => e.toJson()).toList(),
+ 'area_id': instance.areaId,
+ 'location_code': instance.locationCode,
+ 'delivery': instance.delivery,
+ 'requested_delivery_time': instance.requestedDeliveryTime,
+ 'payment_type': instance.paymentType,
+ 'full_name': instance.fullName,
+ 'customer_id': instance.customerId,
+ 'customer_name': instance.customerName,
+ 'customer_comment': instance.customerComment,
+ 'order_type': instance.orderType,
+ 'delivery_price': instance.deliveryPrice,
+ 'total_price': instance.totalPrice,
+ 'total_price_before_savings': instance.totalPriceBeforeSavings,
+ };
diff --git a/concierge/lib/_generated/data/remote/models/product.g.dart b/concierge/lib/_generated/data/remote/models/product.g.dart
new file mode 100644
index 00000000..035604cc
--- /dev/null
+++ b/concierge/lib/_generated/data/remote/models/product.g.dart
@@ -0,0 +1,73 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of '../../../../data/remote/models/product.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+Product _$ProductFromJson(Map json) => Product(
+ id: (json['id'] as num).toInt(),
+ title: json['title'] as String,
+ subTitle: json['sub_title'] as String,
+ body: json['body'] as String,
+ allergies: json['allergies'] as String,
+ price: (json['price'] as num).toDouble(),
+ priceComwellClub: (json['price_comwell_club'] as num).toDouble(),
+ estimatedDeliveryTime: json['estimated_delivery_time'] as String,
+ isNew: const FlagConverter().fromJson((json['is_new'] as num).toInt()),
+ images: (json['images'] as List<dynamic>)
+ .map((e) => MediaImage.fromJson(Map<String, dynamic>.from(e as Map)))
+ .toList(),
+ options: (json['options'] as List<dynamic>)
+ .map((e) => Option.fromJson(Map<String, dynamic>.from(e as Map)))
+ .toList(),
+ type: json['type'] as String,
+);
+
+Map<String, dynamic> _$ProductToJson(Product instance) => <String, dynamic>{
+ 'id': instance.id,
+ 'title': instance.title,
+ 'sub_title': instance.subTitle,
+ 'body': instance.body,
+ 'allergies': instance.allergies,
+ 'price': instance.price,
+ 'price_comwell_club': instance.priceComwellClub,
+ 'estimated_delivery_time': instance.estimatedDeliveryTime,
+ 'is_new': const FlagConverter().toJson(instance.isNew),
+ 'images': instance.images.map((e) => e.toJson()).toList(),
+ 'options': instance.options.map((e) => e.toJson()).toList(),
+ 'type': instance.type,
+};
+
+Option _$OptionFromJson(Map json) => Option(
+ id: (json['id'] as num).toInt(),
+ name: json['name'] as String,
+ productId: (json['product_id'] as num).toInt(),
+ answers: (json['answers'] as List<dynamic>)
+ .map((e) => Answer.fromJson(Map<String, dynamic>.from(e as Map)))
+ .toList(),
+);
+
+Map<String, dynamic> _$OptionToJson(Option instance) => <String, dynamic>{
+ 'id': instance.id,
+ 'name': instance.name,
+ 'product_id': instance.productId,
+ 'answers': instance.answers.map((e) => e.toJson()).toList(),
+};
+
+Answer _$AnswerFromJson(Map json) => Answer(
+ id: (json['id'] as num).toInt(),
+ name: json['name'] as String,
+ isDefault: (json['is_default'] as num).toInt(),
+ productOptionId: (json['product_option_id'] as num).toInt(),
+ isSelected: json['is_selected'] as bool,
+);
+
+Map<String, dynamic> _$AnswerToJson(Answer instance) => <String, dynamic>{
+ 'id': instance.id,
+ 'name': instance.name,
+ 'is_default': instance.isDefault,
+ 'product_option_id': instance.productOptionId,
+ 'is_selected': instance.isSelected,
+};
diff --git a/concierge/lib/_generated/data/remote/models/promotion.g.dart b/concierge/lib/_generated/data/remote/models/promotion.g.dart
new file mode 100644
index 00000000..75d8a4be
--- /dev/null
+++ b/concierge/lib/_generated/data/remote/models/promotion.g.dart
@@ -0,0 +1,19 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of '../../../../data/remote/models/promotion.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+Promotion _$PromotionFromJson(Map json) => Promotion(
+ title: json['title'] as String,
+ products: (json['products'] as List<dynamic>)
+ .map((e) => (e as num).toInt())
+ .toList(),
+);
+
+Map<String, dynamic> _$PromotionToJson(Promotion instance) => <String, dynamic>{
+ 'title': instance.title,
+ 'products': instance.products,
+};
diff --git a/concierge/lib/_generated/data/remote/models/promotion_dto.g.dart b/concierge/lib/_generated/data/remote/models/promotion_dto.g.dart
deleted file mode 100644
index cd08e382..00000000
--- a/concierge/lib/_generated/data/remote/models/promotion_dto.g.dart
+++ /dev/null
@@ -1,17 +0,0 @@
-// GENERATED CODE - DO NOT MODIFY BY HAND
-
-part of '../../../../data/remote/models/promotion_dto.dart';
-
-// **************************************************************************
-// JsonSerializableGenerator
-// **************************************************************************
-
-PromotionDto _$PromotionDtoFromJson(Map json) => PromotionDto(
- title: json['title'] as String,
- products: (json['products'] as List<dynamic>)
- .map((e) => (e as num).toInt())
- .toList(),
-);
-
-Map<String, dynamic> _$PromotionDtoToJson(PromotionDto instance) =>
- <String, dynamic>{'title': instance.title, 'products': instance.products};
diff --git a/concierge/lib/_generated/data/remote/models/property.g.dart b/concierge/lib/_generated/data/remote/models/property.g.dart
new file mode 100644
index 00000000..d0851337
--- /dev/null
+++ b/concierge/lib/_generated/data/remote/models/property.g.dart
@@ -0,0 +1,59 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of '../../../../data/remote/models/property.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+Property _$PropertyFromJson(Map json) => Property(
+ id: (json['id'] as num).toInt(),
+ name: json['name'] as String,
+ domain: json['domain'] as String,
+ languageCode: json['language_code'] as String,
+ currency: json['currency'] as String,
+ hotline: json['hotline'] as String,
+ showInMenu: const FlagConverter().fromJson(
+ (json['show_in_menu'] as num).toInt(),
+ ),
+ helpBody: json['help_body'] as String,
+ splashVideo: json['splash_video'] as String?,
+ areas: (json['areas'] as List<dynamic>)
+ .map((e) => PropertyArea.fromJson(Map<String, dynamic>.from(e as Map)))
+ .toList(),
+ heroImages: (json['hero_images'] as List<dynamic>)
+ .map((e) => MediaImage.fromJson(Map<String, dynamic>.from(e as Map)))
+ .toList(),
+ logoImage: MediaImage.fromJson(
+ Map<String, dynamic>.from(json['logo_image'] as Map),
+ ),
+ profileImage: MediaImage.fromJson(
+ Map<String, dynamic>.from(json['profile_image'] as Map),
+ ),
+ intros: (json['intros'] as List<dynamic>)
+ .map((e) => PropertyIntro.fromJson(Map<String, dynamic>.from(e as Map)))
+ .toList(),
+ menuItems: json['menu_items'] as List<dynamic>,
+ rejectMessages: (json['reject_messages'] as List<dynamic>)
+ .map((e) => RejectMessage.fromJson(Map<String, dynamic>.from(e as Map)))
+ .toList(),
+);
+
+Map<String, dynamic> _$PropertyToJson(Property instance) => <String, dynamic>{
+ 'id': instance.id,
+ 'name': instance.name,
+ 'domain': instance.domain,
+ 'language_code': instance.languageCode,
+ 'currency': instance.currency,
+ 'hotline': instance.hotline,
+ 'show_in_menu': const FlagConverter().toJson(instance.showInMenu),
+ 'help_body': instance.helpBody,
+ 'splash_video': instance.splashVideo,
+ 'areas': instance.areas.map((e) => e.toJson()).toList(),
+ 'hero_images': instance.heroImages.map((e) => e.toJson()).toList(),
+ 'logo_image': instance.logoImage.toJson(),
+ 'profile_image': instance.profileImage.toJson(),
+ 'intros': instance.intros.map((e) => e.toJson()).toList(),
+ 'menu_items': instance.menuItems,
+ 'reject_messages': instance.rejectMessages.map((e) => e.toJson()).toList(),
+};
diff --git a/concierge/lib/_generated/data/remote/models/property_area.g.dart b/concierge/lib/_generated/data/remote/models/property_area.g.dart
new file mode 100644
index 00000000..4a3e41f0
--- /dev/null
+++ b/concierge/lib/_generated/data/remote/models/property_area.g.dart
@@ -0,0 +1,59 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of '../../../../data/remote/models/property_area.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+PropertyArea _$PropertyAreaFromJson(Map json) => PropertyArea(
+ id: (json['id'] as num).toInt(),
+ name: json['name'] as String,
+ pickupText: json['pickup_text'] as String,
+ deliveryText: json['delivery_text'] as String,
+ isOpen: const FlagConverter().fromJson((json['is_open'] as num).toInt()),
+ isMeetingArea: const FlagConverter().fromJson(
+ (json['is_meeting_area'] as num).toInt(),
+ ),
+ isGuestArea: const FlagConverter().fromJson(
+ (json['is_guest_area'] as num).toInt(),
+ ),
+ isPrearrivalArea: const FlagConverter().fromJson(
+ (json['is_prearrival_area'] as num).toInt(),
+ ),
+ theme: json['theme'] as String,
+ icon: json['icon'] as String,
+ deliveryPrice: (json['delivery_price'] as num?)?.toInt() ?? 0,
+ isDeliveryDefault: const FlagConverter().fromJson(
+ (json['is_delivery_default'] as num).toInt(),
+ ),
+ hasDelivery: const FlagConverter().fromJson(
+ (json['has_delivery'] as num).toInt(),
+ ),
+ events: (json['events'] as List<dynamic>)
+ .map((e) => PropertyEvent.fromJson(Map<String, dynamic>.from(e as Map)))
+ .toList(),
+ skipLocation: json['skip_location'] as bool,
+);
+
+Map<String, dynamic> _$PropertyAreaToJson(
+ PropertyArea instance,
+) => <String, dynamic>{
+ 'id': instance.id,
+ 'name': instance.name,
+ 'pickup_text': instance.pickupText,
+ 'delivery_text': instance.deliveryText,
+ 'is_open': const FlagConverter().toJson(instance.isOpen),
+ 'is_meeting_area': const FlagConverter().toJson(instance.isMeetingArea),
+ 'is_guest_area': const FlagConverter().toJson(instance.isGuestArea),
+ 'is_prearrival_area': const FlagConverter().toJson(instance.isPrearrivalArea),
+ 'theme': instance.theme,
+ 'icon': instance.icon,
+ 'delivery_price': instance.deliveryPrice,
+ 'is_delivery_default': const FlagConverter().toJson(
+ instance.isDeliveryDefault,
+ ),
+ 'has_delivery': const FlagConverter().toJson(instance.hasDelivery),
+ 'events': instance.events.map((e) => e.toJson()).toList(),
+ 'skip_location': instance.skipLocation,
+};
diff --git a/concierge/lib/_generated/data/remote/models/property_area_dto.g.dart b/concierge/lib/_generated/data/remote/models/property_area_dto.g.dart
deleted file mode 100644
index 10b08b7e..00000000
--- a/concierge/lib/_generated/data/remote/models/property_area_dto.g.dart
+++ /dev/null
@@ -1,48 +0,0 @@
-// GENERATED CODE - DO NOT MODIFY BY HAND
-
-part of '../../../../data/remote/models/property_area_dto.dart';
-
-// **************************************************************************
-// JsonSerializableGenerator
-// **************************************************************************
-
-PropertyAreaDto _$PropertyAreaDtoFromJson(Map json) => PropertyAreaDto(
- id: (json['id'] as num).toInt(),
- name: json['name'] as String,
- pickupText: json['pickup_text'] as String,
- deliveryText: json['delivery_text'] as String,
- isOpen: (json['is_open'] as num).toInt(),
- isMeetingArea: (json['is_meeting_area'] as num).toInt(),
- isGuestArea: (json['is_guest_area'] as num).toInt(),
- isPrearrivalArea: (json['is_prearrival_area'] as num).toInt(),
- theme: json['theme'] as String,
- icon: json['icon'] as String,
- deliveryPrice: (json['delivery_price'] as num?)?.toInt(),
- isDeliveryDefault: (json['is_delivery_default'] as num).toInt(),
- hasDelivery: (json['has_delivery'] as num).toInt(),
- events: (json['events'] as List<dynamic>)
- .map(
- (e) => PropertyEventDto.fromJson(Map<String, dynamic>.from(e as Map)),
- )
- .toList(),
- skipLocation: json['skip_location'] as bool,
-);
-
-Map<String, dynamic> _$PropertyAreaDtoToJson(PropertyAreaDto instance) =>
- <String, dynamic>{
- 'id': instance.id,
- 'name': instance.name,
- 'pickup_text': instance.pickupText,
- 'delivery_text': instance.deliveryText,
- 'is_open': instance.isOpen,
- 'is_meeting_area': instance.isMeetingArea,
- 'is_guest_area': instance.isGuestArea,
- 'is_prearrival_area': instance.isPrearrivalArea,
- 'theme': instance.theme,
- 'icon': instance.icon,
- 'delivery_price': instance.deliveryPrice,
- 'is_delivery_default': instance.isDeliveryDefault,
- 'has_delivery': instance.hasDelivery,
- 'events': instance.events.map((e) => e.toJson()).toList(),
- 'skip_location': instance.skipLocation,
- };
diff --git a/concierge/lib/_generated/data/remote/models/property_dto.g.dart b/concierge/lib/_generated/data/remote/models/property_dto.g.dart
deleted file mode 100644
index 73781b53..00000000
--- a/concierge/lib/_generated/data/remote/models/property_dto.g.dart
+++ /dev/null
@@ -1,63 +0,0 @@
-// GENERATED CODE - DO NOT MODIFY BY HAND
-
-part of '../../../../data/remote/models/property_dto.dart';
-
-// **************************************************************************
-// JsonSerializableGenerator
-// **************************************************************************
-
-PropertyDto _$PropertyDtoFromJson(Map json) => PropertyDto(
- id: (json['id'] as num).toInt(),
- name: json['name'] as String,
- domain: json['domain'] as String,
- languageCode: json['language_code'] as String,
- currency: json['currency'] as String,
- hotline: json['hotline'] as String,
- showInMenu: (json['show_in_menu'] as num).toInt(),
- helpBody: json['help_body'] as String,
- splashVideo: json['splash_video'] as String?,
- areas: (json['areas'] as List<dynamic>)
- .map((e) => PropertyAreaDto.fromJson(Map<String, dynamic>.from(e as Map)))
- .toList(),
- heroImages: (json['hero_images'] as List<dynamic>)
- .map((e) => MediaImageDto.fromJson(Map<String, dynamic>.from(e as Map)))
- .toList(),
- logoImage: MediaImageDto.fromJson(
- Map<String, dynamic>.from(json['logo_image'] as Map),
- ),
- profileImage: MediaImageDto.fromJson(
- Map<String, dynamic>.from(json['profile_image'] as Map),
- ),
- intros: (json['intros'] as List<dynamic>)
- .map(
- (e) => PropertyIntroDto.fromJson(Map<String, dynamic>.from(e as Map)),
- )
- .toList(),
- menuItems: json['menu_items'] as List<dynamic>,
- rejectMessages: (json['reject_messages'] as List<dynamic>)
- .map(
- (e) => RejectMessageDto.fromJson(Map<String, dynamic>.from(e as Map)),
- )
- .toList(),
-);
-
-Map<String, dynamic> _$PropertyDtoToJson(
- PropertyDto instance,
-) => <String, dynamic>{
- 'id': instance.id,
- 'name': instance.name,
- 'domain': instance.domain,
- 'language_code': instance.languageCode,
- 'currency': instance.currency,
- 'hotline': instance.hotline,
- 'show_in_menu': instance.showInMenu,
- 'help_body': instance.helpBody,
- 'splash_video': instance.splashVideo,
- 'areas': instance.areas.map((e) => e.toJson()).toList(),
- 'hero_images': instance.heroImages.map((e) => e.toJson()).toList(),
- 'logo_image': instance.logoImage.toJson(),
- 'profile_image': instance.profileImage.toJson(),
- 'intros': instance.intros.map((e) => e.toJson()).toList(),
- 'menu_items': instance.menuItems,
- 'reject_messages': instance.rejectMessages.map((e) => e.toJson()).toList(),
-};
diff --git a/concierge/lib/_generated/data/remote/models/property_event.g.dart b/concierge/lib/_generated/data/remote/models/property_event.g.dart
new file mode 100644
index 00000000..08131c63
--- /dev/null
+++ b/concierge/lib/_generated/data/remote/models/property_event.g.dart
@@ -0,0 +1,26 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of '../../../../data/remote/models/property_event.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+PropertyEvent _$PropertyEventFromJson(Map json) => PropertyEvent(
+ id: (json['id'] as num).toInt(),
+ title: json['title'] as String,
+ subTitle: json['sub_title'] as String,
+ ctaLink: json['cta_link'] as String?,
+ heroImage: MediaImage.fromJson(
+ Map<String, dynamic>.from(json['hero_image'] as Map),
+ ),
+);
+
+Map<String, dynamic> _$PropertyEventToJson(PropertyEvent instance) =>
+ <String, dynamic>{
+ 'id': instance.id,
+ 'title': instance.title,
+ 'sub_title': instance.subTitle,
+ 'cta_link': instance.ctaLink,
+ 'hero_image': instance.heroImage.toJson(),
+ };
diff --git a/concierge/lib/_generated/data/remote/models/property_event_dto.g.dart b/concierge/lib/_generated/data/remote/models/property_event_dto.g.dart
deleted file mode 100644
index 65e9cd8d..00000000
--- a/concierge/lib/_generated/data/remote/models/property_event_dto.g.dart
+++ /dev/null
@@ -1,26 +0,0 @@
-// GENERATED CODE - DO NOT MODIFY BY HAND
-
-part of '../../../../data/remote/models/property_event_dto.dart';
-
-// **************************************************************************
-// JsonSerializableGenerator
-// **************************************************************************
-
-PropertyEventDto _$PropertyEventDtoFromJson(Map json) => PropertyEventDto(
- id: (json['id'] as num).toInt(),
- title: json['title'] as String,
- subTitle: json['sub_title'] as String,
- ctaLink: json['cta_link'] as String?,
- heroImage: MediaImageDto.fromJson(
- Map<String, dynamic>.from(json['hero_image'] as Map),
- ),
-);
-
-Map<String, dynamic> _$PropertyEventDtoToJson(PropertyEventDto instance) =>
- <String, dynamic>{
- 'id': instance.id,
- 'title': instance.title,
- 'sub_title': instance.subTitle,
- 'cta_link': instance.ctaLink,
- 'hero_image': instance.heroImage.toJson(),
- };
diff --git a/concierge/lib/_generated/data/remote/models/property_intro.g.dart b/concierge/lib/_generated/data/remote/models/property_intro.g.dart
new file mode 100644
index 00000000..bf6555c4
--- /dev/null
+++ b/concierge/lib/_generated/data/remote/models/property_intro.g.dart
@@ -0,0 +1,26 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of '../../../../data/remote/models/property_intro.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+PropertyIntro _$PropertyIntroFromJson(Map json) => PropertyIntro(
+ id: (json['id'] as num).toInt(),
+ title: json['title'] as String,
+ description: json['description'] as String,
+ theme: json['theme'] as String,
+ heroImage: MediaImage.fromJson(
+ Map<String, dynamic>.from(json['hero_image'] as Map),
+ ),
+);
+
+Map<String, dynamic> _$PropertyIntroToJson(PropertyIntro instance) =>
+ <String, dynamic>{
+ 'id': instance.id,
+ 'title': instance.title,
+ 'description': instance.description,
+ 'theme': instance.theme,
+ 'hero_image': instance.heroImage.toJson(),
+ };
diff --git a/concierge/lib/_generated/data/remote/models/property_intro_dto.g.dart b/concierge/lib/_generated/data/remote/models/property_intro_dto.g.dart
deleted file mode 100644
index c2718b06..00000000
--- a/concierge/lib/_generated/data/remote/models/property_intro_dto.g.dart
+++ /dev/null
@@ -1,26 +0,0 @@
-// GENERATED CODE - DO NOT MODIFY BY HAND
-
-part of '../../../../data/remote/models/property_intro_dto.dart';
-
-// **************************************************************************
-// JsonSerializableGenerator
-// **************************************************************************
-
-PropertyIntroDto _$PropertyIntroDtoFromJson(Map json) => PropertyIntroDto(
- id: (json['id'] as num).toInt(),
- title: json['title'] as String,
- description: json['description'] as String,
- theme: json['theme'] as String,
- heroImage: MediaImageDto.fromJson(
- Map<String, dynamic>.from(json['hero_image'] as Map),
- ),
-);
-
-Map<String, dynamic> _$PropertyIntroDtoToJson(PropertyIntroDto instance) =>
- <String, dynamic>{
- 'id': instance.id,
- 'title': instance.title,
- 'description': instance.description,
- 'theme': instance.theme,
- 'hero_image': instance.heroImage.toJson(),
- };
diff --git a/concierge/lib/_generated/data/remote/models/reject_message.g.dart b/concierge/lib/_generated/data/remote/models/reject_message.g.dart
new file mode 100644
index 00000000..dd0763f2
--- /dev/null
+++ b/concierge/lib/_generated/data/remote/models/reject_message.g.dart
@@ -0,0 +1,13 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of '../../../../data/remote/models/reject_message.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+RejectMessage _$RejectMessageFromJson(Map json) =>
+ RejectMessage(title: json['title'] as String, text: json['text'] as String);
+
+Map<String, dynamic> _$RejectMessageToJson(RejectMessage instance) =>
+ <String, dynamic>{'title': instance.title, 'text': instance.text};
diff --git a/concierge/lib/_generated/data/remote/models/reject_message_dto.g.dart b/concierge/lib/_generated/data/remote/models/reject_message_dto.g.dart
deleted file mode 100644
index 37c1e7d7..00000000
--- a/concierge/lib/_generated/data/remote/models/reject_message_dto.g.dart
+++ /dev/null
@@ -1,15 +0,0 @@
-// GENERATED CODE - DO NOT MODIFY BY HAND
-
-part of '../../../../data/remote/models/reject_message_dto.dart';
-
-// **************************************************************************
-// JsonSerializableGenerator
-// **************************************************************************
-
-RejectMessageDto _$RejectMessageDtoFromJson(Map json) => RejectMessageDto(
- title: json['title'] as String,
- text: json['text'] as String,
-);
-
-Map<String, dynamic> _$RejectMessageDtoToJson(RejectMessageDto instance) =>
- <String, dynamic>{'title': instance.title, 'text': instance.text};
diff --git a/concierge/lib/_generated/presentation/screens/hotel_overview_page/bloc/hotel_overview_page_state.freezed.dart b/concierge/lib/_generated/presentation/screens/hotel_overview_page/bloc/hotel_overview_page_state.freezed.dart
index ff1a9da5..ef3f123c 100644
--- a/concierge/lib/_generated/presentation/screens/hotel_overview_page/bloc/hotel_overview_page_state.freezed.dart
+++ b/concierge/lib/_generated/presentation/screens/hotel_overview_page/bloc/hotel_overview_page_state.freezed.dart
@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$HotelOverviewPageState {
- bool get isLoading; String get errorMessage; Property? get property; int? get selectedAreaId;
+ bool get isLoading; String get errorMessage; int get selectedAreaId; Map<int, DataState> get areas; Property? get property;
/// Create a copy of HotelOverviewPageState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -25,16 +25,16 @@ $HotelOverviewPageStateCopyWith<HotelOverviewPageState> get copyWith => _$HotelO
@override
bool operator ==(Object other) {
- return identical(this, other) || (other.runtimeType == runtimeType&&other is HotelOverviewPageState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.property, property) || other.property == property)&&(identical(other.selectedAreaId, selectedAreaId) || other.selectedAreaId == selectedAreaId));
+ return identical(this, other) || (other.runtimeType == runtimeType&&other is HotelOverviewPageState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.selectedAreaId, selectedAreaId) || other.selectedAreaId == selectedAreaId)&&const DeepCollectionEquality().equals(other.areas, areas)&&(identical(other.property, property) || other.property == property));
}
@override
-int get hashCode => Object.hash(runtimeType,isLoading,errorMessage,property,selectedAreaId);
+int get hashCode => Object.hash(runtimeType,isLoading,errorMessage,selectedAreaId,const DeepCollectionEquality().hash(areas),property);
@override
String toString() {
- return 'HotelOverviewPageState(isLoading: $isLoading, errorMessage: $errorMessage, property: $property, selectedAreaId: $selectedAreaId)';
+ return 'HotelOverviewPageState(isLoading: $isLoading, errorMessage: $errorMessage, selectedAreaId: $selectedAreaId, areas: $areas, property: $property)';
}
@@ -45,7 +45,7 @@ abstract mixin class $HotelOverviewPageStateCopyWith<$Res> {
factory $HotelOverviewPageStateCopyWith(HotelOverviewPageState value, $Res Function(HotelOverviewPageState) _then) = _$HotelOverviewPageStateCopyWithImpl;
@useResult
$Res call({
- bool isLoading, String errorMessage, Property? property, int? selectedAreaId
+ bool isLoading, String errorMessage, int selectedAreaId, Map<int, DataState> areas, Property? property
});
@@ -62,13 +62,14 @@ class _$HotelOverviewPageStateCopyWithImpl<$Res>
/// Create a copy of HotelOverviewPageState
/// with the given fields replaced by the non-null parameter values.
-@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? errorMessage = null,Object? property = freezed,Object? selectedAreaId = freezed,}) {
+@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? errorMessage = null,Object? selectedAreaId = null,Object? areas = null,Object? property = freezed,}) {
return _then(_self.copyWith(
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
-as String,property: freezed == property ? _self.property : property // ignore: cast_nullable_to_non_nullable
-as Property?,selectedAreaId: freezed == selectedAreaId ? _self.selectedAreaId : selectedAreaId // ignore: cast_nullable_to_non_nullable
-as int?,
+as String,selectedAreaId: null == selectedAreaId ? _self.selectedAreaId : selectedAreaId // ignore: cast_nullable_to_non_nullable
+as int,areas: null == areas ? _self.areas : areas // ignore: cast_nullable_to_non_nullable
+as Map<int, DataState>,property: freezed == property ? _self.property : property // ignore: cast_nullable_to_non_nullable
+as Property?,
));
}
@@ -153,10 +154,10 @@ return $default(_that);case _:
/// }
/// ```
-@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, String errorMessage, Property? property, int? selectedAreaId)? $default,{required TResult orElse(),}) {final _that = this;
+@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, String errorMessage, int selectedAreaId, Map<int, DataState> areas, Property? property)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _HotelOverviewPageState() when $default != null:
-return $default(_that.isLoading,_that.errorMessage,_that.property,_that.selectedAreaId);case _:
+return $default(_that.isLoading,_that.errorMessage,_that.selectedAreaId,_that.areas,_that.property);case _:
return orElse();
}
@@ -174,10 +175,10 @@ return $default(_that.isLoading,_that.errorMessage,_that.property,_that.selected
/// }
/// ```
-@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, String errorMessage, Property? property, int? selectedAreaId) $default,) {final _that = this;
+@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, String errorMessage, int selectedAreaId, Map<int, DataState> areas, Property? property) $default,) {final _that = this;
switch (_that) {
case _HotelOverviewPageState():
-return $default(_that.isLoading,_that.errorMessage,_that.property,_that.selectedAreaId);case _:
+return $default(_that.isLoading,_that.errorMessage,_that.selectedAreaId,_that.areas,_that.property);case _:
throw StateError('Unexpected subclass');
}
@@ -194,10 +195,10 @@ return $default(_that.isLoading,_that.errorMessage,_that.property,_that.selected
/// }
/// ```
-@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, String errorMessage, Property? property, int? selectedAreaId)? $default,) {final _that = this;
+@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, String errorMessage, int selectedAreaId, Map<int, DataState> areas, Property? property)? $default,) {final _that = this;
switch (_that) {
case _HotelOverviewPageState() when $default != null:
-return $default(_that.isLoading,_that.errorMessage,_that.property,_that.selectedAreaId);case _:
+return $default(_that.isLoading,_that.errorMessage,_that.selectedAreaId,_that.areas,_that.property);case _:
return null;
}
@@ -209,13 +210,20 @@ return $default(_that.isLoading,_that.errorMessage,_that.property,_that.selected
class _HotelOverviewPageState implements HotelOverviewPageState {
- const _HotelOverviewPageState({this.isLoading = false, this.errorMessage = "", this.property, this.selectedAreaId});
+ const _HotelOverviewPageState({this.isLoading = false, this.errorMessage = "", this.selectedAreaId = 0, final Map<int, DataState> areas = const {}, this.property}): _areas = areas;
@override@JsonKey() final bool isLoading;
@override@JsonKey() final String errorMessage;
+@override@JsonKey() final int selectedAreaId;
+ final Map<int, DataState> _areas;
+@override@JsonKey() Map<int, DataState> get areas {
+ if (_areas is EqualUnmodifiableMapView) return _areas;
+ // ignore: implicit_dynamic_type
+ return EqualUnmodifiableMapView(_areas);
+}
+
@override final Property? property;
-@override final int? selectedAreaId;
/// Create a copy of HotelOverviewPageState
/// with the given fields replaced by the non-null parameter values.
@@ -227,16 +235,16 @@ _$HotelOverviewPageStateCopyWith<_HotelOverviewPageState> get copyWith => __$Hot
@override
bool operator ==(Object other) {
- return identical(this, other) || (other.runtimeType == runtimeType&&other is _HotelOverviewPageState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.property, property) || other.property == property)&&(identical(other.selectedAreaId, selectedAreaId) || other.selectedAreaId == selectedAreaId));
+ return identical(this, other) || (other.runtimeType == runtimeType&&other is _HotelOverviewPageState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.selectedAreaId, selectedAreaId) || other.selectedAreaId == selectedAreaId)&&const DeepCollectionEquality().equals(other._areas, _areas)&&(identical(other.property, property) || other.property == property));
}
@override
-int get hashCode => Object.hash(runtimeType,isLoading,errorMessage,property,selectedAreaId);
+int get hashCode => Object.hash(runtimeType,isLoading,errorMessage,selectedAreaId,const DeepCollectionEquality().hash(_areas),property);
@override
String toString() {
- return 'HotelOverviewPageState(isLoading: $isLoading, errorMessage: $errorMessage, property: $property, selectedAreaId: $selectedAreaId)';
+ return 'HotelOverviewPageState(isLoading: $isLoading, errorMessage: $errorMessage, selectedAreaId: $selectedAreaId, areas: $areas, property: $property)';
}
@@ -247,7 +255,7 @@ abstract mixin class _$HotelOverviewPageStateCopyWith<$Res> implements $HotelOve
factory _$HotelOverviewPageStateCopyWith(_HotelOverviewPageState value, $Res Function(_HotelOverviewPageState) _then) = __$HotelOverviewPageStateCopyWithImpl;
@override @useResult
$Res call({
- bool isLoading, String errorMessage, Property? property, int? selectedAreaId
+ bool isLoading, String errorMessage, int selectedAreaId, Map<int, DataState> areas, Property? property
});
@@ -264,13 +272,14 @@ class __$HotelOverviewPageStateCopyWithImpl<$Res>
/// Create a copy of HotelOverviewPageState
/// with the given fields replaced by the non-null parameter values.
-@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? errorMessage = null,Object? property = freezed,Object? selectedAreaId = freezed,}) {
+@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? errorMessage = null,Object? selectedAreaId = null,Object? areas = null,Object? property = freezed,}) {
return _then(_HotelOverviewPageState(
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
-as String,property: freezed == property ? _self.property : property // ignore: cast_nullable_to_non_nullable
-as Property?,selectedAreaId: freezed == selectedAreaId ? _self.selectedAreaId : selectedAreaId // ignore: cast_nullable_to_non_nullable
-as int?,
+as String,selectedAreaId: null == selectedAreaId ? _self.selectedAreaId : selectedAreaId // ignore: cast_nullable_to_non_nullable
+as int,areas: null == areas ? _self._areas : areas // ignore: cast_nullable_to_non_nullable
+as Map<int, DataState>,property: freezed == property ? _self.property : property // ignore: cast_nullable_to_non_nullable
+as Property?,
));
}
diff --git a/concierge/lib/concierge.dart b/concierge/lib/concierge.dart
index 0eee4d68..537312e1 100644
--- a/concierge/lib/concierge.dart
+++ b/concierge/lib/concierge.dart
@@ -1,64 +1,11 @@
-import 'package:flutter/widgets.dart';
-import 'concierge_config.dart';
import 'concierge_platform_interface.dart';
-import 'flavors.dart';
-import 'presentation/app/concierge_hotel_overview.dart';
export 'concierge_config.dart';
export 'flavors.dart';
-export 'presentation/app/concierge_hotel_overview.dart';
class Concierge {
Future<String?> getPlatformVersion() {
return ConciergePlatform.instance.getPlatformVersion();
}
-
- /// Host-app entry point: build the Hotel Overview UI for a given hotel + user token.
- ///
- /// Typical usage from the host app:
- ///
- /// Using `go_router`:
- /// ```dart
- /// // routes:
- /// // GoRoute(
- /// // path: '/concierge/:hotelCode',
- /// // builder: (context, state) => Concierge.hotelOverview(
- /// // flavor: Flavor.stage,
- /// // hotelCode: state.pathParameters['hotelCode']!,
- /// // userToken: '<token>',
- /// // ),
- /// // ),
- /// //
- /// // open from an image button:
- /// context.push('/concierge/ccp');
- /// ```
- ///
- /// Using `Navigator`:
- /// ```dart
- /// Navigator.of(context).push(
- /// MaterialPageRoute(
- /// builder: (_) => Concierge.hotelOverview(
- /// flavor: Flavor.stage,
- /// hotelCode: "ccp",
- /// userToken: token,
- /// ),
- /// ),
- /// );
- /// ```
- static Widget hotelOverview({
- required Flavor flavor,
- required String hotelCode,
- String? userToken,
- }) {
- return ConciergeHotelOverview(
- config: ConciergeConfig(
- flavor: flavor,
- hotelCode: hotelCode,
- userToken: userToken,
- ),
- );
- }
}
-
-
diff --git a/concierge/lib/concierge_app.dart b/concierge/lib/concierge_app.dart
new file mode 100644
index 00000000..a1e066cd
--- /dev/null
+++ b/concierge/lib/concierge_app.dart
@@ -0,0 +1,113 @@
+import 'package:concierge/data/local/secure_storage/concierge_secure_storage.dart';
+import 'package:concierge/data/remote/api/concierge_interceptor.dart';
+import 'package:concierge/data/remote/api/concierge_service.dart';
+import 'package:concierge/domain/repositories/property_repository.dart';
+import 'package:concierge/presentation/navigation/router.dart';
+import 'package:concierge/presentation/screens/hotel_overview_page/bloc/hotel_overview_page_cubit.dart';
+import 'package:dio/dio.dart';
+import 'package:flutter/foundation.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
+import 'package:flutter_secure_storage/flutter_secure_storage.dart';
+import 'package:pretty_dio_logger/pretty_dio_logger.dart';
+
+import 'flavors.dart';
+
+/// Host-app entry point: build the Hotel Overview UI for a given hotel + user token.
+///
+/// Typical usage from the host app:
+///
+/// Using `go_router`:
+/// ```dart
+/// // routes:
+/// // GoRoute(
+/// // path: '/concierge/:hotelCode',
+/// // builder: (context, state) => Concierge.hotelOverview(
+/// // flavor: Flavor.stage,
+/// // hotelCode: state.pathParameters['hotelCode']!,
+/// // userToken: '<token>',
+/// // ),
+/// // ),
+/// //
+/// // open from an image button:
+/// context.push('/concierge/ccp');
+/// ```
+///
+/// Using `Navigator`:
+/// ```dart
+/// Navigator.of(context).push(
+/// MaterialPageRoute(
+/// builder: (_) => Concierge.hotelOverview(
+/// flavor: Flavor.stage,
+/// hotelCode: "ccp",
+/// userToken: token,
+/// ),
+/// ),
+/// );
+/// ```
+///
+
+class ConciergeApp extends StatelessWidget {
+ const ConciergeApp({
+ super.key,
+ required this.authToken,
+ required this.flavor,
+ required this.hotelCode,
+ });
+
+ final String hotelCode;
+ final String authToken;
+ final String flavor;
+
+ Future<(ConciergeService, ConciergeSecureStorage)> _getDependencies() async {
+ F.appFlavor = Flavor.values.firstWhere((flavor) {
+ return flavor.name == this.flavor.toLowerCase();
+ });
+ final storage = ConciergeSecureStorage(FlutterSecureStorage());
+ final dio = Dio(BaseOptions(baseUrl: F.baseUrl));
+ dio.interceptors.addAll([
+ ConciergeInterceptor(storage),
+ if (kDebugMode) PrettyDioLogger(requestBody: true, requestHeader: true),
+ ]);
+ await storage.setUserToken(authToken);
+ return (ConciergeService(dio), storage);
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return FutureBuilder(
+ future: _getDependencies(),
+ builder: (context, asyncSnapshot) {
+ if (asyncSnapshot.connectionState == ConnectionState.waiting) {
+ return Center(child: CircularProgressIndicator());
+ }
+ if (asyncSnapshot.hasError) {
+ print("qqq err=${asyncSnapshot.error}");
+ print("qqq st=${asyncSnapshot.stackTrace}");
+ return Center(child: Text(asyncSnapshot.error.toString()));
+ }
+ final (service, storage) = asyncSnapshot.data!;
+ return MultiRepositoryProvider(
+ providers: [
+ RepositoryProvider(create: (context) => PropertyRepository(service)),
+ RepositoryProvider(create: (context) => storage),
+ ],
+ child: MultiBlocProvider(
+ providers: [
+ BlocProvider(
+ create: (context) => HotelOverviewPageCubit(context.read(), hotelCode: hotelCode),
+ ),
+ ],
+ child: Builder(
+ builder: (context) {
+ return MaterialApp.router(
+ routerConfig: router(),
+ );
+ },
+ ),
+ ),
+ );
+ },
+ );
+ }
+}
diff --git a/concierge/lib/data/remote/api/concierge_interceptor.dart b/concierge/lib/data/remote/api/concierge_interceptor.dart
new file mode 100644
index 00000000..24501e4b
--- /dev/null
+++ b/concierge/lib/data/remote/api/concierge_interceptor.dart
@@ -0,0 +1,17 @@
+import 'package:concierge/data/local/secure_storage/concierge_secure_storage.dart';
+import 'package:dio/dio.dart';
+
+class ConciergeInterceptor extends Interceptor {
+ final ConciergeSecureStorage _conciergeSecureStorage;
+
+ const ConciergeInterceptor(this._conciergeSecureStorage);
+
+ @override
+ void onRequest(RequestOptions options, RequestInterceptorHandler handler) async {
+ final token = await _conciergeSecureStorage.getUserToken();
+ if (token != null) {
+ options.headers["Authorization"] = token;
+ }
+ super.onRequest(options, handler);
+ }
+}
diff --git a/concierge/lib/data/remote/api/concierge_service.dart b/concierge/lib/data/remote/api/concierge_service.dart
index 302a947d..8e21127e 100644
--- a/concierge/lib/data/remote/api/concierge_service.dart
+++ b/concierge/lib/data/remote/api/concierge_service.dart
@@ -1,8 +1,12 @@
+import 'package:concierge/data/remote/models/api_response.dart';
+import 'package:concierge/data/remote/models/order.dart';
+import 'package:concierge/data/remote/models/order_review.dart';
+import 'package:concierge/data/remote/models/product.dart';
+import 'package:concierge/data/remote/models/property.dart';
import 'package:dio/dio.dart';
import 'package:retrofit/retrofit.dart';
-import 'package:concierge/data/remote/models/get_property_response_dto.dart';
-import 'package:concierge/data/remote/models/get_area_response_dto.dart';
+import '../models/area_details.dart';
part '../../../_generated/data/remote/api/concierge_service.g.dart';
@@ -10,29 +14,24 @@ part '../../../_generated/data/remote/api/concierge_service.g.dart';
abstract class ConciergeService {
factory ConciergeService(Dio dio, {String? baseUrl}) = _ConciergeService;
- @GET("/hotels/domains/{hotelcode}")
- Future<GetPropertyResponseDto> getHotelOverview(
- @Path("hotelcode") String hotelcode);
+ @GET("/hotels/domains/{hotelCode}")
+ Future<ApiResponse<Property>> getHotelOverview(@Path("hotelCode") String hotelCode);
- // TODO: Add DTOs/models for the endpoints below (Area/Product/Order/etc) and
- // re-enable them.
- //
@GET("/areas/{areaid}")
- Future<GetAreaResponseDto> getArea(@Path("areaid") String areaid);
- //
- // @GET("/products/{productid}")
- // Future<Product> getProduct(@Path("productid") String productid);
- //
- // @POST("/orders/review")
- // Future<OrderReview> getOrderReview(@Body() OrderReviewDto orderReviewDto);
- //
- // @POST("/orders/")
- // Future<Order> createOrder(@Body() OrderDto orderDto);
- //
- // @GET("/orders/{orderid}")
- // Future<Order> getOrder(@Path("orderid") String orderid);
- //
- // @GET("/customers/me/orders")
- // Future<List<Order>> getCustomerOrders();
-
-}
\ No newline at end of file
+ Future<ApiResponse<AreaDetails>> getArea(@Path("areaid") int areaId);
+
+ @GET("/products/{productid}")
+ Future<ApiResponse<Product>> getProduct(@Path("productid") String productid);
+
+ @POST("/orders/review")
+ Future<ApiResponse<OrderReview>> getOrderReview(@Body() Map<String, dynamic> body);
+
+ @POST("/orders/")
+ Future<ApiResponse<Order>> createOrder(@Body() Map<String, dynamic> body);
+
+ @GET("/orders/{orderid}")
+ Future<ApiResponse<Order>> getOrder(@Path("orderid") String orderId);
+
+ @GET("/customers/me/orders")
+ Future<ApiResponse<List<Order>>> getCustomerOrders();
+}
diff --git a/concierge/lib/data/remote/converters/flag_converter.dart b/concierge/lib/data/remote/converters/flag_converter.dart
new file mode 100644
index 00000000..a455de85
--- /dev/null
+++ b/concierge/lib/data/remote/converters/flag_converter.dart
@@ -0,0 +1,17 @@
+import 'package:freezed_annotation/freezed_annotation.dart';
+
+class FlagConverter extends JsonConverter<bool, int> {
+ const FlagConverter();
+
+ @override
+ bool fromJson(int value) {
+ if (value == 1) return true;
+ return false;
+ }
+
+ @override
+ int toJson(bool value) {
+ if (value) return 1;
+ return 0;
+ }
+}
diff --git a/concierge/lib/data/remote/models/api_response.dart b/concierge/lib/data/remote/models/api_response.dart
new file mode 100644
index 00000000..80eace12
--- /dev/null
+++ b/concierge/lib/data/remote/models/api_response.dart
@@ -0,0 +1,13 @@
+import 'package:freezed_annotation/freezed_annotation.dart';
+
+part '../../../_generated/data/remote/models/api_response.g.dart';
+
+@JsonSerializable(genericArgumentFactories: true, createToJson: false)
+class ApiResponse<T> {
+ final T data;
+
+ const ApiResponse({required this.data});
+
+ factory ApiResponse.fromJson(Map<String, dynamic> json, T Function(Object? json) fromJsonT) =>
+ _$ApiResponseFromJson(json, fromJsonT);
+}
diff --git a/concierge/lib/data/remote/models/area_category.dart b/concierge/lib/data/remote/models/area_category.dart
new file mode 100644
index 00000000..2e9ff1bc
--- /dev/null
+++ b/concierge/lib/data/remote/models/area_category.dart
@@ -0,0 +1,25 @@
+import 'package:json_annotation/json_annotation.dart';
+
+import 'area_sub_category.dart';
+
+part '../../../_generated/data/remote/models/area_category.g.dart';
+
+@JsonSerializable(fieldRename: FieldRename.snake)
+class AreaCategory {
+ final int id;
+ final String name;
+ final List<AreaSubCategory> subCategories;
+
+ AreaCategory({
+ required this.id,
+ required this.name,
+ required this.subCategories,
+ });
+
+ factory AreaCategory.fromJson(Map<String, dynamic> json) =>
+ _$AreaCategoryFromJson(json);
+
+ Map<String, dynamic> toJson() => _$AreaCategoryToJson(this);
+}
+
+
diff --git a/concierge/lib/data/remote/models/area_category_dto.dart b/concierge/lib/data/remote/models/area_category_dto.dart
deleted file mode 100644
index feefbe61..00000000
--- a/concierge/lib/data/remote/models/area_category_dto.dart
+++ /dev/null
@@ -1,26 +0,0 @@
-import 'package:json_annotation/json_annotation.dart';
-
-import 'area_sub_category_dto.dart';
-
-part '../../../_generated/data/remote/models/area_category_dto.g.dart';
-
-@JsonSerializable()
-class AreaCategoryDto {
- final int id;
- final String name;
- @JsonKey(name: 'sub_categories')
- final List<AreaSubCategoryDto> subCategories;
-
- AreaCategoryDto({
- required this.id,
- required this.name,
- required this.subCategories,
- });
-
- factory AreaCategoryDto.fromJson(Map<String, dynamic> json) =>
- _$AreaCategoryDtoFromJson(json);
-
- Map<String, dynamic> toJson() => _$AreaCategoryDtoToJson(this);
-}
-
-
diff --git a/concierge/lib/data/remote/models/area_details.dart b/concierge/lib/data/remote/models/area_details.dart
new file mode 100644
index 00000000..3438df16
--- /dev/null
+++ b/concierge/lib/data/remote/models/area_details.dart
@@ -0,0 +1,64 @@
+import 'package:json_annotation/json_annotation.dart';
+
+import '../converters/flag_converter.dart';
+import 'area_category.dart';
+import 'promotion.dart';
+import 'property_event.dart';
+
+part '../../../_generated/data/remote/models/area_details.g.dart';
+
+@JsonSerializable(fieldRename: FieldRename.snake)
+class AreaDetails {
+ final int id;
+ final String name;
+ final String pickupText;
+ final String deliveryText;
+ @FlagConverter()
+ final bool isOpen;
+ @FlagConverter()
+ final bool isMeetingArea;
+ @FlagConverter()
+ final bool isGuestArea;
+ @FlagConverter()
+ final bool isPrearrivalArea;
+ final String theme;
+ /// Note: in some endpoints this is a string like "BED"; in others it may be a URL.
+ final String icon;
+ final int? deliveryPrice;
+ @FlagConverter()
+ final bool isDeliveryDefault;
+ @FlagConverter()
+ final bool hasDelivery;
+ final List<PropertyEvent> events;
+ final bool skipLocation;
+ final List<AreaCategory> categories;
+ final Promotion promotion;
+ final List<dynamic> deliveryTimes;
+ final List<dynamic> supportItems;
+
+ const AreaDetails({
+ required this.id,
+ required this.name,
+ required this.pickupText,
+ required this.deliveryText,
+ required this.isOpen,
+ required this.isMeetingArea,
+ required this.isGuestArea,
+ required this.isPrearrivalArea,
+ required this.theme,
+ required this.icon,
+ required this.deliveryPrice,
+ required this.isDeliveryDefault,
+ required this.hasDelivery,
+ required this.events,
+ required this.skipLocation,
+ required this.categories,
+ required this.promotion,
+ required this.deliveryTimes,
+ required this.supportItems,
+ });
+
+ factory AreaDetails.fromJson(Map<String, dynamic> json) => _$AreaDetailsFromJson(json);
+
+ Map<String, dynamic> toJson() => _$AreaDetailsToJson(this);
+}
diff --git a/concierge/lib/data/remote/models/area_details_dto.dart b/concierge/lib/data/remote/models/area_details_dto.dart
deleted file mode 100644
index fb06d3c4..00000000
--- a/concierge/lib/data/remote/models/area_details_dto.dart
+++ /dev/null
@@ -1,75 +0,0 @@
-import 'package:json_annotation/json_annotation.dart';
-
-import 'area_category_dto.dart';
-import 'promotion_dto.dart';
-import 'property_event_dto.dart';
-
-part '../../../_generated/data/remote/models/area_details_dto.g.dart';
-
-@JsonSerializable()
-class AreaDetailsDto {
- final int id;
- final String name;
- @JsonKey(name: 'pickup_text')
- final String pickupText;
- @JsonKey(name: 'delivery_text')
- final String deliveryText;
- @JsonKey(name: 'is_open')
- final int isOpen;
- @JsonKey(name: 'is_meeting_area')
- final int isMeetingArea;
- @JsonKey(name: 'is_guest_area')
- final int isGuestArea;
- @JsonKey(name: 'is_prearrival_area')
- final int isPrearrivalArea;
- final String theme;
-
- /// Note: in some endpoints this is a string like "BED"; in others it may be a URL.
- final String icon;
-
- @JsonKey(name: 'delivery_price')
- final int deliveryPrice;
- @JsonKey(name: 'is_delivery_default')
- final int isDeliveryDefault;
- @JsonKey(name: 'has_delivery')
- final int hasDelivery;
- final List<PropertyEventDto> events;
- @JsonKey(name: 'skip_location')
- final bool skipLocation;
-
- final List<AreaCategoryDto> categories;
- final PromotionDto promotion;
- @JsonKey(name: 'delivery_times')
- final List<dynamic> deliveryTimes;
- @JsonKey(name: 'support_items')
- final List<dynamic> supportItems;
-
- AreaDetailsDto({
- required this.id,
- required this.name,
- required this.pickupText,
- required this.deliveryText,
- required this.isOpen,
- required this.isMeetingArea,
- required this.isGuestArea,
- required this.isPrearrivalArea,
- required this.theme,
- required this.icon,
- required this.deliveryPrice,
- required this.isDeliveryDefault,
- required this.hasDelivery,
- required this.events,
- required this.skipLocation,
- required this.categories,
- required this.promotion,
- required this.deliveryTimes,
- required this.supportItems,
- });
-
- factory AreaDetailsDto.fromJson(Map<String, dynamic> json) =>
- _$AreaDetailsDtoFromJson(json);
-
- Map<String, dynamic> toJson() => _$AreaDetailsDtoToJson(this);
-}
-
-
diff --git a/concierge/lib/data/remote/models/area_sub_category.dart b/concierge/lib/data/remote/models/area_sub_category.dart
new file mode 100644
index 00000000..2450dc1e
--- /dev/null
+++ b/concierge/lib/data/remote/models/area_sub_category.dart
@@ -0,0 +1,33 @@
+import 'package:json_annotation/json_annotation.dart';
+
+import 'media_image.dart';
+
+part '../../../_generated/data/remote/models/area_sub_category.g.dart';
+
+@JsonSerializable(fieldRename: FieldRename.snake)
+class AreaSubCategory {
+ final int id;
+ final String name;
+ final String subTitle;
+ final String heroTitle;
+ final String description;
+ final MediaImage heroImage;
+ final List<int> products;
+
+ const AreaSubCategory({
+ required this.id,
+ required this.name,
+ required this.subTitle,
+ required this.heroTitle,
+ required this.description,
+ required this.heroImage,
+ required this.products,
+ });
+
+ factory AreaSubCategory.fromJson(Map<String, dynamic> json) =>
+ _$AreaSubCategoryFromJson(json);
+
+ Map<String, dynamic> toJson() => _$AreaSubCategoryToJson(this);
+}
+
+
diff --git a/concierge/lib/data/remote/models/area_sub_category_dto.dart b/concierge/lib/data/remote/models/area_sub_category_dto.dart
deleted file mode 100644
index f65536bd..00000000
--- a/concierge/lib/data/remote/models/area_sub_category_dto.dart
+++ /dev/null
@@ -1,38 +0,0 @@
-import 'package:json_annotation/json_annotation.dart';
-
-import 'media_image_dto.dart';
-
-part '../../../_generated/data/remote/models/area_sub_category_dto.g.dart';
-
-@JsonSerializable()
-class AreaSubCategoryDto {
- final int id;
- final String name;
- @JsonKey(name: 'sub_title')
- final String subTitle;
- @JsonKey(name: 'hero_title')
- final String heroTitle;
- final String description;
- @JsonKey(name: 'hero_image')
- final MediaImageDto heroImage;
-
- /// Product ids (as delivered by backend)
- final List<int> products;
-
- AreaSubCategoryDto({
- required this.id,
- required this.name,
- required this.subTitle,
- required this.heroTitle,
- required this.description,
- required this.heroImage,
- required this.products,
- });
-
- factory AreaSubCategoryDto.fromJson(Map<String, dynamic> json) =>
- _$AreaSubCategoryDtoFromJson(json);
-
- Map<String, dynamic> toJson() => _$AreaSubCategoryDtoToJson(this);
-}
-
-
diff --git a/concierge/lib/data/remote/models/get_area_response.dart b/concierge/lib/data/remote/models/get_area_response.dart
new file mode 100644
index 00000000..e69de29b
diff --git a/concierge/lib/data/remote/models/get_area_response_dto.dart b/concierge/lib/data/remote/models/get_area_response_dto.dart
deleted file mode 100644
index d245b670..00000000
--- a/concierge/lib/data/remote/models/get_area_response_dto.dart
+++ /dev/null
@@ -1,19 +0,0 @@
-import 'package:json_annotation/json_annotation.dart';
-
-import 'area_details_dto.dart';
-
-part '../../../_generated/data/remote/models/get_area_response_dto.g.dart';
-
-@JsonSerializable()
-class GetAreaResponseDto {
- final AreaDetailsDto data;
-
- GetAreaResponseDto({required this.data});
-
- factory GetAreaResponseDto.fromJson(Map<String, dynamic> json) =>
- _$GetAreaResponseDtoFromJson(json);
-
- Map<String, dynamic> toJson() => _$GetAreaResponseDtoToJson(this);
-}
-
-
diff --git a/concierge/lib/data/remote/models/get_property_response.dart b/concierge/lib/data/remote/models/get_property_response.dart
new file mode 100644
index 00000000..5699e02e
--- /dev/null
+++ b/concierge/lib/data/remote/models/get_property_response.dart
@@ -0,0 +1,13 @@
+import 'package:json_annotation/json_annotation.dart';
+
+import 'property.dart';
+
+part '../../../_generated/data/remote/models/get_property_response.g.dart';
+
+@JsonSerializable(fieldRename: FieldRename.snake)
+class GetPropertyResponse {
+ final Property data;
+
+ const GetPropertyResponse({required this.data});
+
+}
diff --git a/concierge/lib/data/remote/models/get_property_response_dto.dart b/concierge/lib/data/remote/models/get_property_response_dto.dart
deleted file mode 100644
index 34467b47..00000000
--- a/concierge/lib/data/remote/models/get_property_response_dto.dart
+++ /dev/null
@@ -1,19 +0,0 @@
-import 'package:json_annotation/json_annotation.dart';
-
-import 'property_dto.dart';
-
-part '../../../_generated/data/remote/models/get_property_response_dto.g.dart';
-
-@JsonSerializable()
-class GetPropertyResponseDto {
- final PropertyDto data;
-
- GetPropertyResponseDto({required this.data});
-
- factory GetPropertyResponseDto.fromJson(Map<String, dynamic> json) =>
- _$GetPropertyResponseDtoFromJson(json);
-
- Map<String, dynamic> toJson() => _$GetPropertyResponseDtoToJson(this);
-}
-
-
diff --git a/concierge/lib/data/remote/models/media_image.dart b/concierge/lib/data/remote/models/media_image.dart
new file mode 100644
index 00000000..b2671ef2
--- /dev/null
+++ b/concierge/lib/data/remote/models/media_image.dart
@@ -0,0 +1,27 @@
+import 'package:json_annotation/json_annotation.dart';
+
+part '../../../_generated/data/remote/models/media_image.g.dart';
+
+@JsonSerializable(fieldRename: FieldRename.snake)
+class MediaImage {
+ final String url;
+ final String preload;
+ final String thumbnail;
+ final String productHero;
+ final String alt;
+
+ const MediaImage({
+ required this.url,
+ required this.preload,
+ required this.thumbnail,
+ required this.productHero,
+ required this.alt,
+ });
+
+ factory MediaImage.fromJson(Map<String, dynamic> json) =>
+ _$MediaImageFromJson(json);
+
+ Map<String, dynamic> toJson() => _$MediaImageToJson(this);
+}
+
+
diff --git a/concierge/lib/data/remote/models/media_image_dto.dart b/concierge/lib/data/remote/models/media_image_dto.dart
deleted file mode 100644
index 1dbd37ce..00000000
--- a/concierge/lib/data/remote/models/media_image_dto.dart
+++ /dev/null
@@ -1,28 +0,0 @@
-import 'package:json_annotation/json_annotation.dart';
-
-part '../../../_generated/data/remote/models/media_image_dto.g.dart';
-
-@JsonSerializable()
-class MediaImageDto {
- final String url;
- final String preload;
- final String thumbnail;
- @JsonKey(name: 'product_hero')
- final String productHero;
- final String alt;
-
- MediaImageDto({
- required this.url,
- required this.preload,
- required this.thumbnail,
- required this.productHero,
- required this.alt,
- });
-
- factory MediaImageDto.fromJson(Map<String, dynamic> json) =>
- _$MediaImageDtoFromJson(json);
-
- Map<String, dynamic> toJson() => _$MediaImageDtoToJson(this);
-}
-
-
diff --git a/concierge/lib/data/remote/models/order.dart b/concierge/lib/data/remote/models/order.dart
new file mode 100644
index 00000000..8f985271
--- /dev/null
+++ b/concierge/lib/data/remote/models/order.dart
@@ -0,0 +1,182 @@
+// To parse this JSON data, do
+//
+// final order = orderFromJson(jsonString);
+
+import 'package:json_annotation/json_annotation.dart';
+import 'dart:convert';
+
+part '../../../_generated/data/remote/models/order.g.dart';
+
+
+Order orderFromJson(String str) => Order.fromJson(json.decode(str));
+
+String orderToJson(Order data) => json.encode(data.toJson());
+
+@JsonSerializable(fieldRename: FieldRename.snake)
+class Order {
+ final int id;
+ final String status;
+ final String type;
+ final bool isArchived;
+ final dynamic archivedAt;
+ final dynamic cancelReason;
+ final int totalPrice;
+ final String deliveryMethod;
+ final String requestedDeliveryTime;
+ final dynamic estimatedDeliveryTime;
+ final dynamic pickupLocation;
+ final int areaId;
+ final int locationId;
+ final DateTime createdAt;
+ final DateTime updatedAt;
+ final dynamic customerComment;
+ final bool delivery;
+ final int deliveryPrice;
+ final String deliveryMethodString;
+ final String statusString;
+ final String typeString;
+ final String locationCode;
+ final List<OrderItem> orderItems;
+ final Payment payment;
+ final Customer customer;
+ final dynamic lastUpdateFrom;
+ final Image image;
+
+ Order({
+ required this.id,
+ required this.status,
+ required this.type,
+ required this.isArchived,
+ required this.archivedAt,
+ required this.cancelReason,
+ required this.totalPrice,
+ required this.deliveryMethod,
+ required this.requestedDeliveryTime,
+ required this.estimatedDeliveryTime,
+ required this.pickupLocation,
+ required this.areaId,
+ required this.locationId,
+ required this.createdAt,
+ required this.updatedAt,
+ required this.customerComment,
+ required this.delivery,
+ required this.deliveryPrice,
+ required this.deliveryMethodString,
+ required this.statusString,
+ required this.typeString,
+ required this.locationCode,
+ required this.orderItems,
+ required this.payment,
+ required this.customer,
+ required this.lastUpdateFrom,
+ required this.image,
+ });
+
+ factory Order.fromJson(Map<String, dynamic> json) => _$OrderFromJson(json);
+
+ Map<String, dynamic> toJson() => _$OrderToJson(this);
+}
+
+@JsonSerializable(fieldRename: FieldRename.snake)
+class Customer {
+ final int id;
+ final String firstName;
+ final dynamic lastName;
+ final dynamic email;
+ final int isComwellClub;
+ final String phone;
+ final String phonePrefix;
+
+ Customer({
+ required this.id,
+ required this.firstName,
+ required this.lastName,
+ required this.email,
+ required this.isComwellClub,
+ required this.phone,
+ required this.phonePrefix,
+ });
+
+ factory Customer.fromJson(Map<String, dynamic> json) => _$CustomerFromJson(json);
+
+ Map<String, dynamic> toJson() => _$CustomerToJson(this);
+}
+
+@JsonSerializable(fieldRename: FieldRename.snake)
+class Image {
+ final String url;
+ final String preload;
+ final String thumbnail;
+ final String productHero;
+ final String alt;
+
+ Image({
+ required this.url,
+ required this.preload,
+ required this.thumbnail,
+ required this.productHero,
+ required this.alt,
+ });
+
+ factory Image.fromJson(Map<String, dynamic> json) => _$ImageFromJson(json);
+
+ Map<String, dynamic> toJson() => _$ImageToJson(this);
+}
+
+@JsonSerializable(fieldRename: FieldRename.snake)
+class OrderItem {
+ final int id;
+ final int price;
+ final int quantity;
+ final String itemType;
+ final String alternativeName;
+ final int? productId;
+ final int orderId;
+ final List<dynamic>? options;
+ final String itemTypeString;
+ final List<dynamic> vouchers;
+ final int totalPrice;
+ final int totalPriceBeforeSavings;
+
+ OrderItem({
+ required this.id,
+ required this.price,
+ required this.quantity,
+ required this.itemType,
+ required this.alternativeName,
+ required this.productId,
+ required this.orderId,
+ required this.options,
+ required this.itemTypeString,
+ required this.vouchers,
+ required this.totalPrice,
+ required this.totalPriceBeforeSavings,
+ });
+
+ factory OrderItem.fromJson(Map<String, dynamic> json) => _$OrderItemFromJson(json);
+
+ Map<String, dynamic> toJson() => _$OrderItemToJson(this);
+}
+
+@JsonSerializable(fieldRename: FieldRename.snake)
+class Payment {
+ final int id;
+ final String paymentType;
+ final dynamic room;
+ final dynamic meeting;
+ final dynamic fullName;
+ final String paymentTypeString;
+
+ Payment({
+ required this.id,
+ required this.paymentType,
+ required this.room,
+ required this.meeting,
+ required this.fullName,
+ required this.paymentTypeString,
+ });
+
+ factory Payment.fromJson(Map<String, dynamic> json) => _$PaymentFromJson(json);
+
+ Map<String, dynamic> toJson() => _$PaymentToJson(this);
+}
diff --git a/concierge/lib/data/remote/models/order_review.dart b/concierge/lib/data/remote/models/order_review.dart
new file mode 100644
index 00000000..dd4a8ee1
--- /dev/null
+++ b/concierge/lib/data/remote/models/order_review.dart
@@ -0,0 +1,43 @@
+import 'package:concierge/data/remote/models/product.dart';
+import 'package:json_annotation/json_annotation.dart';
+
+part '../../../_generated/data/remote/models/order_review.g.dart';
+
+@JsonSerializable(fieldRename: FieldRename.snake)
+class OrderReview {
+ final List<Product> products;
+ final int areaId;
+ final String locationCode;
+ final bool delivery;
+ final String requestedDeliveryTime;
+ final String paymentType;
+ final String fullName;
+ final String customerId;
+ final String customerName;
+ final String customerComment;
+ final String orderType;
+ final double deliveryPrice;
+ final double totalPrice;
+ final double totalPriceBeforeSavings;
+
+ OrderReview({
+ required this.products,
+ required this.areaId,
+ required this.locationCode,
+ required this.delivery,
+ required this.requestedDeliveryTime,
+ required this.paymentType,
+ required this.fullName,
+ required this.customerId,
+ required this.customerName,
+ required this.customerComment,
+ required this.orderType,
+ required this.deliveryPrice,
+ required this.totalPrice,
+ required this.totalPriceBeforeSavings,
+ });
+
+ factory OrderReview.fromJson(Map<String, dynamic> json) => _$OrderReviewFromJson(json);
+
+ Map<String, dynamic> toJson() => _$OrderReviewToJson(this);
+}
diff --git a/concierge/lib/data/remote/models/product.dart b/concierge/lib/data/remote/models/product.dart
new file mode 100644
index 00000000..b4e38cb9
--- /dev/null
+++ b/concierge/lib/data/remote/models/product.dart
@@ -0,0 +1,81 @@
+import 'package:concierge/data/remote/converters/flag_converter.dart';
+import 'package:concierge/data/remote/models/media_image.dart';
+import 'package:json_annotation/json_annotation.dart';
+
+part '../../../_generated/data/remote/models/product.g.dart';
+
+@JsonSerializable(fieldRename: FieldRename.snake)
+class Product {
+ final int id;
+ final String title;
+ final String subTitle;
+ final String body;
+ final String allergies;
+ final double price;
+ final double priceComwellClub;
+ final String estimatedDeliveryTime;
+ @FlagConverter()
+ final bool isNew;
+ final List<MediaImage> images;
+ final List<Option> options;
+ final String type;
+
+ Product({
+ required this.id,
+ required this.title,
+ required this.subTitle,
+ required this.body,
+ required this.allergies,
+ required this.price,
+ required this.priceComwellClub,
+ required this.estimatedDeliveryTime,
+ required this.isNew,
+ required this.images,
+ required this.options,
+ required this.type,
+ });
+
+ factory Product.fromJson(Map<String, dynamic> json) => _$ProductFromJson(json);
+
+ Map<String, dynamic> toJson() => _$ProductToJson(this);
+}
+
+@JsonSerializable(fieldRename: FieldRename.snake)
+class Option {
+ final int id;
+ final String name;
+ final int productId;
+ final List<Answer> answers;
+
+ const Option({
+ required this.id,
+ required this.name,
+ required this.productId,
+ required this.answers,
+ });
+
+ factory Option.fromJson(Map<String, dynamic> json) => _$OptionFromJson(json);
+
+ Map<String, dynamic> toJson() => _$OptionToJson(this);
+}
+
+@JsonSerializable(fieldRename: FieldRename.snake)
+class Answer {
+ final int id;
+ final String name;
+ final int isDefault;
+ final int productOptionId;
+ final bool isSelected;
+
+ const Answer({
+ required this.id,
+ required this.name,
+ required this.isDefault,
+ required this.productOptionId,
+ required this.isSelected,
+ });
+
+ factory Answer.fromJson(Map<String, dynamic> json) => _$AnswerFromJson(json);
+
+ Map<String, dynamic> toJson() => _$AnswerToJson(this);
+}
diff --git a/concierge/lib/data/remote/models/promotion.dart b/concierge/lib/data/remote/models/promotion.dart
new file mode 100644
index 00000000..2f9fac63
--- /dev/null
+++ b/concierge/lib/data/remote/models/promotion.dart
@@ -0,0 +1,15 @@
+import 'package:json_annotation/json_annotation.dart';
+
+part '../../../_generated/data/remote/models/promotion.g.dart';
+
+@JsonSerializable(fieldRename: FieldRename.snake)
+class Promotion {
+ final String title;
+ final List<int> products;
+
+ const Promotion({required this.title, required this.products});
+
+ factory Promotion.fromJson(Map<String, dynamic> json) => _$PromotionFromJson(json);
+
+ Map<String, dynamic> toJson() => _$PromotionToJson(this);
+}
diff --git a/concierge/lib/data/remote/models/promotion_dto.dart b/concierge/lib/data/remote/models/promotion_dto.dart
deleted file mode 100644
index 08306ff0..00000000
--- a/concierge/lib/data/remote/models/promotion_dto.dart
+++ /dev/null
@@ -1,20 +0,0 @@
-import 'package:json_annotation/json_annotation.dart';
-
-part '../../../_generated/data/remote/models/promotion_dto.g.dart';
-
-@JsonSerializable()
-class PromotionDto {
- final String title;
-
- /// Product ids (often empty in response examples).
- final List<int> products;
-
- PromotionDto({required this.title, required this.products});
-
- factory PromotionDto.fromJson(Map<String, dynamic> json) =>
- _$PromotionDtoFromJson(json);
-
- Map<String, dynamic> toJson() => _$PromotionDtoToJson(this);
-}
-
-
diff --git a/concierge/lib/data/remote/models/property.dart b/concierge/lib/data/remote/models/property.dart
new file mode 100644
index 00000000..01a9b5b0
--- /dev/null
+++ b/concierge/lib/data/remote/models/property.dart
@@ -0,0 +1,54 @@
+import 'package:concierge/data/remote/converters/flag_converter.dart';
+import 'package:json_annotation/json_annotation.dart';
+
+import 'media_image.dart';
+import 'property_area.dart';
+import 'property_intro.dart';
+import 'reject_message.dart';
+
+part '../../../_generated/data/remote/models/property.g.dart';
+
+@JsonSerializable(fieldRename: FieldRename.snake)
+class Property {
+ final int id;
+ final String name;
+ final String domain;
+ final String languageCode;
+ final String currency;
+ final String hotline;
+ @FlagConverter()
+ final bool showInMenu;
+ final String helpBody;
+ final String? splashVideo;
+ final List<PropertyArea> areas;
+ final List<MediaImage> heroImages;
+ final MediaImage logoImage;
+ final MediaImage profileImage;
+ final List<PropertyIntro> intros;
+ final List<dynamic> menuItems;
+ final List<RejectMessage> rejectMessages;
+
+ const Property({
+ required this.id,
+ required this.name,
+ required this.domain,
+ required this.languageCode,
+ required this.currency,
+ required this.hotline,
+ required this.showInMenu,
+ required this.helpBody,
+ required this.splashVideo,
+ required this.areas,
+ required this.heroImages,
+ required this.logoImage,
+ required this.profileImage,
+ required this.intros,
+ required this.menuItems,
+ required this.rejectMessages,
+ });
+
+ factory Property.fromJson(Map<String, dynamic> json) =>
+ _$PropertyFromJson(json);
+
+ Map<String, dynamic> toJson() => _$PropertyToJson(this);
+}
diff --git a/concierge/lib/data/remote/models/property_area.dart b/concierge/lib/data/remote/models/property_area.dart
new file mode 100644
index 00000000..2ab2f5c5
--- /dev/null
+++ b/concierge/lib/data/remote/models/property_area.dart
@@ -0,0 +1,54 @@
+import 'package:json_annotation/json_annotation.dart';
+
+import '../converters/flag_converter.dart';
+import 'property_event.dart';
+
+part '../../../_generated/data/remote/models/property_area.g.dart';
+
+@JsonSerializable(fieldRename: FieldRename.snake)
+class PropertyArea {
+ final int id;
+ final String name;
+ final String pickupText;
+ final String deliveryText;
+ @FlagConverter()
+ final bool isOpen;
+ @FlagConverter()
+ final bool isMeetingArea;
+ @FlagConverter()
+ final bool isGuestArea;
+ @FlagConverter()
+ final bool isPrearrivalArea;
+ final String theme;
+ final String icon;
+ @JsonKey(defaultValue: 0)
+ final int deliveryPrice;
+ @FlagConverter()
+ final bool isDeliveryDefault;
+ @FlagConverter()
+ final bool hasDelivery;
+ final List<PropertyEvent> events;
+ final bool skipLocation;
+
+ const PropertyArea({
+ required this.id,
+ required this.name,
+ required this.pickupText,
+ required this.deliveryText,
+ required this.isOpen,
+ required this.isMeetingArea,
+ required this.isGuestArea,
+ required this.isPrearrivalArea,
+ required this.theme,
+ required this.icon,
+ required this.deliveryPrice,
+ required this.isDeliveryDefault,
+ required this.hasDelivery,
+ required this.events,
+ required this.skipLocation,
+ });
+
+ factory PropertyArea.fromJson(Map<String, dynamic> json) => _$PropertyAreaFromJson(json);
+
+ Map<String, dynamic> toJson() => _$PropertyAreaToJson(this);
+}
diff --git a/concierge/lib/data/remote/models/property_area_dto.dart b/concierge/lib/data/remote/models/property_area_dto.dart
deleted file mode 100644
index d02945d6..00000000
--- a/concierge/lib/data/remote/models/property_area_dto.dart
+++ /dev/null
@@ -1,59 +0,0 @@
-import 'package:json_annotation/json_annotation.dart';
-
-import 'property_event_dto.dart';
-
-part '../../../_generated/data/remote/models/property_area_dto.g.dart';
-
-@JsonSerializable()
-class PropertyAreaDto {
- final int id;
- final String name;
- @JsonKey(name: 'pickup_text')
- final String pickupText;
- @JsonKey(name: 'delivery_text')
- final String deliveryText;
- @JsonKey(name: 'is_open')
- final int isOpen;
- @JsonKey(name: 'is_meeting_area')
- final int isMeetingArea;
- @JsonKey(name: 'is_guest_area')
- final int isGuestArea;
- @JsonKey(name: 'is_prearrival_area')
- final int isPrearrivalArea;
- final String theme;
- final String icon;
- @JsonKey(name: 'delivery_price')
- final int? deliveryPrice;
- @JsonKey(name: 'is_delivery_default')
- final int isDeliveryDefault;
- @JsonKey(name: 'has_delivery')
- final int hasDelivery;
- final List<PropertyEventDto> events;
- @JsonKey(name: 'skip_location')
- final bool skipLocation;
-
- PropertyAreaDto({
- required this.id,
- required this.name,
- required this.pickupText,
- required this.deliveryText,
- required this.isOpen,
- required this.isMeetingArea,
- required this.isGuestArea,
- required this.isPrearrivalArea,
- required this.theme,
- required this.icon,
- required this.deliveryPrice,
- required this.isDeliveryDefault,
- required this.hasDelivery,
- required this.events,
- required this.skipLocation,
- });
-
- factory PropertyAreaDto.fromJson(Map<String, dynamic> json) =>
- _$PropertyAreaDtoFromJson(json);
-
- Map<String, dynamic> toJson() => _$PropertyAreaDtoToJson(this);
-}
-
-
diff --git a/concierge/lib/data/remote/models/property_dto.dart b/concierge/lib/data/remote/models/property_dto.dart
deleted file mode 100644
index 8e9a0eb1..00000000
--- a/concierge/lib/data/remote/models/property_dto.dart
+++ /dev/null
@@ -1,61 +0,0 @@
-import 'package:json_annotation/json_annotation.dart';
-
-import 'media_image_dto.dart';
-import 'property_area_dto.dart';
-import 'property_intro_dto.dart';
-import 'reject_message_dto.dart';
-
-part '../../../_generated/data/remote/models/property_dto.g.dart';
-
-@JsonSerializable()
-class PropertyDto {
- final int id;
- final String name;
- final String domain;
- @JsonKey(name: 'language_code')
- final String languageCode;
- final String currency;
- final String hotline;
- @JsonKey(name: 'show_in_menu')
- final int showInMenu;
- @JsonKey(name: 'help_body')
- final String helpBody;
- @JsonKey(name: 'splash_video')
- final String? splashVideo;
- final List<PropertyAreaDto> areas;
- @JsonKey(name: 'hero_images')
- final List<MediaImageDto> heroImages;
- @JsonKey(name: 'logo_image')
- final MediaImageDto logoImage;
- @JsonKey(name: 'profile_image')
- final MediaImageDto profileImage;
- final List<PropertyIntroDto> intros;
- @JsonKey(name: 'menu_items')
- final List<dynamic> menuItems;
- @JsonKey(name: 'reject_messages')
- final List<RejectMessageDto> rejectMessages;
-
- PropertyDto({
- required this.id,
- required this.name,
- required this.domain,
- required this.languageCode,
- required this.currency,
- required this.hotline,
- required this.showInMenu,
- required this.helpBody,
- required this.splashVideo,
- required this.areas,
- required this.heroImages,
- required this.logoImage,
- required this.profileImage,
- required this.intros,
- required this.menuItems,
- required this.rejectMessages,
- });
-
- factory PropertyDto.fromJson(Map<String, dynamic> json) =>
- _$PropertyDtoFromJson(json);
-
- Map<String, dynamic> toJson() => _$PropertyDtoToJson(this);
-}
diff --git a/concierge/lib/data/remote/models/property_event.dart b/concierge/lib/data/remote/models/property_event.dart
new file mode 100644
index 00000000..81f9446f
--- /dev/null
+++ b/concierge/lib/data/remote/models/property_event.dart
@@ -0,0 +1,29 @@
+import 'package:json_annotation/json_annotation.dart';
+
+import 'media_image.dart';
+
+part '../../../_generated/data/remote/models/property_event.g.dart';
+
+@JsonSerializable(fieldRename: FieldRename.snake)
+class PropertyEvent {
+ final int id;
+ final String title;
+ final String subTitle;
+ final String? ctaLink;
+ final MediaImage heroImage;
+
+ const PropertyEvent({
+ required this.id,
+ required this.title,
+ required this.subTitle,
+ required this.ctaLink,
+ required this.heroImage,
+ });
+
+ factory PropertyEvent.fromJson(Map<String, dynamic> json) =>
+ _$PropertyEventFromJson(json);
+
+ Map<String, dynamic> toJson() => _$PropertyEventToJson(this);
+}
+
+
diff --git a/concierge/lib/data/remote/models/property_event_dto.dart b/concierge/lib/data/remote/models/property_event_dto.dart
deleted file mode 100644
index df1c381d..00000000
--- a/concierge/lib/data/remote/models/property_event_dto.dart
+++ /dev/null
@@ -1,32 +0,0 @@
-import 'package:json_annotation/json_annotation.dart';
-
-import 'media_image_dto.dart';
-
-part '../../../_generated/data/remote/models/property_event_dto.g.dart';
-
-@JsonSerializable()
-class PropertyEventDto {
- final int id;
- final String title;
- @JsonKey(name: 'sub_title')
- final String subTitle;
- @JsonKey(name: 'cta_link')
- final String? ctaLink;
- @JsonKey(name: 'hero_image')
- final MediaImageDto heroImage;
-
- PropertyEventDto({
- required this.id,
- required this.title,
- required this.subTitle,
- required this.ctaLink,
- required this.heroImage,
- });
-
- factory PropertyEventDto.fromJson(Map<String, dynamic> json) =>
- _$PropertyEventDtoFromJson(json);
-
- Map<String, dynamic> toJson() => _$PropertyEventDtoToJson(this);
-}
-
-
diff --git a/concierge/lib/data/remote/models/property_intro.dart b/concierge/lib/data/remote/models/property_intro.dart
new file mode 100644
index 00000000..010463af
--- /dev/null
+++ b/concierge/lib/data/remote/models/property_intro.dart
@@ -0,0 +1,29 @@
+import 'package:json_annotation/json_annotation.dart';
+
+import 'media_image.dart';
+
+part '../../../_generated/data/remote/models/property_intro.g.dart';
+
+@JsonSerializable(fieldRename: FieldRename.snake)
+class PropertyIntro {
+ final int id;
+ final String title;
+ final String description;
+ final String theme;
+ final MediaImage heroImage;
+
+ PropertyIntro({
+ required this.id,
+ required this.title,
+ required this.description,
+ required this.theme,
+ required this.heroImage,
+ });
+
+ factory PropertyIntro.fromJson(Map<String, dynamic> json) =>
+ _$PropertyIntroFromJson(json);
+
+ Map<String, dynamic> toJson() => _$PropertyIntroToJson(this);
+}
+
+
diff --git a/concierge/lib/data/remote/models/property_intro_dto.dart b/concierge/lib/data/remote/models/property_intro_dto.dart
deleted file mode 100644
index 2da277c2..00000000
--- a/concierge/lib/data/remote/models/property_intro_dto.dart
+++ /dev/null
@@ -1,30 +0,0 @@
-import 'package:json_annotation/json_annotation.dart';
-
-import 'media_image_dto.dart';
-
-part '../../../_generated/data/remote/models/property_intro_dto.g.dart';
-
-@JsonSerializable()
-class PropertyIntroDto {
- final int id;
- final String title;
- final String description;
- final String theme;
- @JsonKey(name: 'hero_image')
- final MediaImageDto heroImage;
-
- PropertyIntroDto({
- required this.id,
- required this.title,
- required this.description,
- required this.theme,
- required this.heroImage,
- });
-
- factory PropertyIntroDto.fromJson(Map<String, dynamic> json) =>
- _$PropertyIntroDtoFromJson(json);
-
- Map<String, dynamic> toJson() => _$PropertyIntroDtoToJson(this);
-}
-
-
diff --git a/concierge/lib/data/remote/models/reject_message.dart b/concierge/lib/data/remote/models/reject_message.dart
new file mode 100644
index 00000000..0b560d7c
--- /dev/null
+++ b/concierge/lib/data/remote/models/reject_message.dart
@@ -0,0 +1,15 @@
+import 'package:json_annotation/json_annotation.dart';
+
+part '../../../_generated/data/remote/models/reject_message.g.dart';
+
+@JsonSerializable(fieldRename: FieldRename.snake)
+class RejectMessage {
+ final String title;
+ final String text;
+
+ const RejectMessage({required this.title, required this.text});
+
+ factory RejectMessage.fromJson(Map<String, dynamic> json) => _$RejectMessageFromJson(json);
+
+ Map<String, dynamic> toJson() => _$RejectMessageToJson(this);
+}
diff --git a/concierge/lib/data/remote/models/reject_message_dto.dart b/concierge/lib/data/remote/models/reject_message_dto.dart
deleted file mode 100644
index ca0a36b6..00000000
--- a/concierge/lib/data/remote/models/reject_message_dto.dart
+++ /dev/null
@@ -1,18 +0,0 @@
-import 'package:json_annotation/json_annotation.dart';
-
-part '../../../_generated/data/remote/models/reject_message_dto.g.dart';
-
-@JsonSerializable()
-class RejectMessageDto {
- final String title;
- final String text;
-
- RejectMessageDto({required this.title, required this.text});
-
- factory RejectMessageDto.fromJson(Map<String, dynamic> json) =>
- _$RejectMessageDtoFromJson(json);
-
- Map<String, dynamic> toJson() => _$RejectMessageDtoToJson(this);
-}
-
-
diff --git a/concierge/lib/data/repositories/property_repository_impl.dart b/concierge/lib/data/repositories/property_repository_impl.dart
deleted file mode 100644
index cf4a97f1..00000000
--- a/concierge/lib/data/repositories/property_repository_impl.dart
+++ /dev/null
@@ -1,18 +0,0 @@
-import 'package:concierge/data/remote/api/concierge_service.dart';
-import 'package:concierge/domain/mappers/property_mapper.dart';
-import 'package:concierge/domain/models/property.dart';
-import 'package:concierge/domain/repositories/property_repository.dart';
-
-class PropertyRepositoryImpl implements PropertyRepository {
- final ConciergeService _service;
-
- PropertyRepositoryImpl(this._service);
-
- @override
- Future<Property> getHotelOverview({required String hotelCode}) async {
- final response = await _service.getHotelOverview(hotelCode);
- return response.toProperty();
- }
-}
-
-
diff --git a/concierge/lib/di/getit.dart b/concierge/lib/di/getit.dart
deleted file mode 100644
index 84246f22..00000000
--- a/concierge/lib/di/getit.dart
+++ /dev/null
@@ -1,98 +0,0 @@
-
-import 'package:concierge/concierge_config.dart';
-import 'package:concierge/flavors.dart';
-import 'package:concierge/data/remote/api/concierge_service.dart';
-import 'package:concierge/data/local/secure_storage/concierge_secure_storage.dart';
-import 'package:concierge/data/repositories/property_repository_impl.dart';
-
-import 'dart:convert';
-import 'dart:io';
-import 'package:dio/dio.dart';
-import 'package:flutter/foundation.dart';
-import 'package:flutter_secure_storage/flutter_secure_storage.dart';
-import 'package:get_it/get_it.dart';
-
-import 'package:concierge/domain/repositories/property_repository.dart';
-import 'package:pretty_dio_logger/pretty_dio_logger.dart';
-
-final getIt = GetIt.instance;
-
-void setupDependencies(ConciergeConfig config) {
- // #region agent log
- void agentLog(String hypothesisId, String location, String message,
- Map<String, dynamic> data) {
- try {
- final client = HttpClient();
- client
- .postUrl(Uri.parse(
- 'http://127.0.0.1:7242/ingest/85a56c1a-3030-4072-b8d0-4f19580c0a8a'))
- .then((req) {
- req.headers.contentType = ContentType.json;
- req.write(jsonEncode({
- 'sessionId': 'debug-session',
- 'runId': 'run1',
- 'hypothesisId': hypothesisId,
- 'location': location,
- 'message': message,
- 'data': data,
- 'timestamp': DateTime.now().millisecondsSinceEpoch,
- }));
- return req.close();
- }).then((_) {
- client.close(force: true);
- }).catchError((_) {
- client.close(force: true);
- });
- } catch (_) {}
- }
-
- agentLog('H0', 'lib/di/getit.dart:setupDependencies', 'setupDependencies called', {
- 'flavor': config.flavor.name,
- 'hotelCode': config.hotelCode,
- 'hasUserToken': (config.userToken != null && config.userToken!.isNotEmpty),
- });
- // #endregion agent log
-
- // Allow re-configuring the plugin each time the host app opens it.
- if (getIt.isRegistered<PropertyRepository>()) {
- getIt.unregister<PropertyRepository>();
- }
- if (getIt.isRegistered<ConciergeService>()) {
- getIt.unregister<ConciergeService>();
- }
- if (getIt.isRegistered<Dio>()) {
- getIt.unregister<Dio>();
- }
- if (getIt.isRegistered<ConciergeConfig>()) {
- getIt.unregister<ConciergeConfig>();
- }
- if (getIt.isRegistered<ConciergeSecureStorage>()) {
- getIt.unregister<ConciergeSecureStorage>();
- }
- if (getIt.isRegistered<FlutterSecureStorage>()) {
- getIt.unregister<FlutterSecureStorage>();
- }
-
- getIt.registerSingleton<ConciergeConfig>(config);
-
- final baseUrl = switch (config.flavor) {
- Flavor.stage => "https://admin-stage.concierge.comwell.com",
- Flavor.production => "https://admin.concierge.comwell.com/api/da/",
- };
-
- final dio = Dio(BaseOptions(baseUrl: baseUrl));
- dio.interceptors.addAll([
- if (kDebugMode) PrettyDioLogger(requestBody: true, requestHeader: true),
- ]);
- getIt.registerSingleton<Dio>(dio);
-
- getIt.registerLazySingleton<FlutterSecureStorage>(
- () => const FlutterSecureStorage());
- getIt.registerLazySingleton<ConciergeSecureStorage>(
- () => ConciergeSecureStorage(getIt<FlutterSecureStorage>()));
-
- getIt.registerLazySingleton<ConciergeService>(() => ConciergeService(dio));
- getIt.registerLazySingleton<PropertyRepository>(
- () => PropertyRepositoryImpl(getIt<ConciergeService>()));
-
-}
diff --git a/concierge/lib/domain/mappers/area_details_mapper.dart b/concierge/lib/domain/mappers/area_details_mapper.dart
deleted file mode 100644
index 0339c7de..00000000
--- a/concierge/lib/domain/mappers/area_details_mapper.dart
+++ /dev/null
@@ -1,99 +0,0 @@
-import 'package:concierge/data/remote/models/area_category_dto.dart';
-import 'package:concierge/data/remote/models/area_details_dto.dart';
-import 'package:concierge/data/remote/models/area_sub_category_dto.dart';
-import 'package:concierge/data/remote/models/get_area_response_dto.dart';
-import 'package:concierge/data/remote/models/media_image_dto.dart';
-import 'package:concierge/data/remote/models/promotion_dto.dart';
-import 'package:concierge/data/remote/models/property_event_dto.dart';
-import 'package:concierge/domain/models/area_category.dart';
-import 'package:concierge/domain/models/area_details.dart';
-import 'package:concierge/domain/models/area_sub_category.dart';
-import 'package:concierge/domain/models/media_image.dart';
-import 'package:concierge/domain/models/promotion.dart';
-import 'package:concierge/domain/models/property_event.dart';
-
-bool _intFlagToBool(int value) => value == 1;
-
-extension GetAreaResponseDtoMapper on GetAreaResponseDto {
- AreaDetails toAreaDetails() => data.toAreaDetails();
-}
-
-extension AreaDetailsDtoMapper on AreaDetailsDto {
- AreaDetails toAreaDetails() {
- return AreaDetails(
- id: id,
- name: name,
- pickupText: pickupText,
- deliveryText: deliveryText,
- isOpen: _intFlagToBool(isOpen),
- isMeetingArea: _intFlagToBool(isMeetingArea),
- isGuestArea: _intFlagToBool(isGuestArea),
- isPrearrivalArea: _intFlagToBool(isPrearrivalArea),
- theme: theme,
- icon: icon,
- deliveryPrice: deliveryPrice,
- isDeliveryDefault: _intFlagToBool(isDeliveryDefault),
- hasDelivery: _intFlagToBool(hasDelivery),
- events: events.map((e) => e.toPropertyEvent()).toList(),
- skipLocation: skipLocation,
- categories: categories.map((c) => c.toAreaCategory()).toList(),
- promotion: promotion.toPromotion(),
- deliveryTimes: deliveryTimes,
- supportItems: supportItems,
- );
- }
-}
-
-extension AreaCategoryDtoMapper on AreaCategoryDto {
- AreaCategory toAreaCategory() {
- return AreaCategory(
- id: id,
- name: name,
- subCategories: subCategories.map((s) => s.toAreaSubCategory()).toList(),
- );
- }
-}
-
-extension AreaSubCategoryDtoMapper on AreaSubCategoryDto {
- AreaSubCategory toAreaSubCategory() {
- return AreaSubCategory(
- id: id,
- name: name,
- subTitle: subTitle,
- heroTitle: heroTitle,
- description: description,
- heroImage: heroImage.toMediaImage(),
- products: products,
- );
- }
-}
-
-extension PromotionDtoMapper on PromotionDto {
- Promotion toPromotion() => Promotion(title: title, products: products);
-}
-
-extension PropertyEventDtoMapper on PropertyEventDto {
- PropertyEvent toPropertyEvent() {
- return PropertyEvent(
- id: id,
- title: title,
- subTitle: subTitle,
- ctaLink: ctaLink,
- heroImage: heroImage.toMediaImage(),
- );
- }
-}
-
-extension MediaImageDtoMapper on MediaImageDto {
- MediaImage toMediaImage() {
- return MediaImage(
- url: url,
- preload: preload,
- thumbnail: thumbnail,
- productHero: productHero,
- alt: alt,
- );
- }
-}
-
-
diff --git a/concierge/lib/domain/mappers/property_mapper.dart b/concierge/lib/domain/mappers/property_mapper.dart
deleted file mode 100644
index 9d5722df..00000000
--- a/concierge/lib/domain/mappers/property_mapper.dart
+++ /dev/null
@@ -1,106 +0,0 @@
-import 'package:concierge/data/remote/models/get_property_response_dto.dart';
-import 'package:concierge/data/remote/models/media_image_dto.dart';
-import 'package:concierge/data/remote/models/property_dto.dart';
-import 'package:concierge/data/remote/models/property_area_dto.dart';
-import 'package:concierge/data/remote/models/property_event_dto.dart';
-import 'package:concierge/data/remote/models/property_intro_dto.dart';
-import 'package:concierge/data/remote/models/reject_message_dto.dart';
-import 'package:concierge/domain/models/media_image.dart';
-import 'package:concierge/domain/models/property.dart';
-import 'package:concierge/domain/models/property_area.dart';
-import 'package:concierge/domain/models/property_event.dart';
-import 'package:concierge/domain/models/property_intro.dart';
-import 'package:concierge/domain/models/reject_message.dart';
-
-bool _intFlagToBool(int value) => value == 1;
-
-extension GetPropertyResponseDtoMapper on GetPropertyResponseDto {
- Property toProperty() => data.toProperty();
-}
-
-extension PropertyDtoMapper on PropertyDto {
- Property toProperty() {
- return Property(
- id: id,
- name: name,
- domain: domain,
- languageCode: languageCode,
- currency: currency,
- hotline: hotline,
- showInMenu: _intFlagToBool(showInMenu),
- helpBody: helpBody,
- splashVideo: splashVideo,
- areas: areas.map((a) => a.toPropertyArea()).toList(),
- heroImages: heroImages.map((i) => i.toMediaImage()).toList(),
- logoImage: logoImage.toMediaImage(),
- profileImage: profileImage.toMediaImage(),
- intros: intros.map((i) => i.toPropertyIntro()).toList(),
- menuItems: menuItems,
- rejectMessages: rejectMessages.map((m) => m.toRejectMessage()).toList(),
- );
- }
-}
-
-extension PropertyAreaDtoMapper on PropertyAreaDto {
- PropertyArea toPropertyArea() {
- return PropertyArea(
- id: id,
- name: name,
- pickupText: pickupText,
- deliveryText: deliveryText,
- isOpen: _intFlagToBool(isOpen),
- isMeetingArea: _intFlagToBool(isMeetingArea),
- isGuestArea: _intFlagToBool(isGuestArea),
- isPrearrivalArea: _intFlagToBool(isPrearrivalArea),
- theme: theme,
- icon: icon,
- deliveryPrice: deliveryPrice ?? 0,
- isDeliveryDefault: _intFlagToBool(isDeliveryDefault),
- hasDelivery: _intFlagToBool(hasDelivery),
- events: events.map((e) => e.toPropertyEvent()).toList(),
- skipLocation: skipLocation,
- );
- }
-}
-
-extension PropertyEventDtoMapper on PropertyEventDto {
- PropertyEvent toPropertyEvent() {
- return PropertyEvent(
- id: id,
- title: title,
- subTitle: subTitle,
- ctaLink: ctaLink,
- heroImage: heroImage.toMediaImage(),
- );
- }
-}
-
-extension PropertyIntroDtoMapper on PropertyIntroDto {
- PropertyIntro toPropertyIntro() {
- return PropertyIntro(
- id: id,
- title: title,
- description: description,
- theme: theme,
- heroImage: heroImage.toMediaImage(),
- );
- }
-}
-
-extension RejectMessageDtoMapper on RejectMessageDto {
- RejectMessage toRejectMessage() => RejectMessage(title: title, text: text);
-}
-
-extension MediaImageDtoMapper on MediaImageDto {
- MediaImage toMediaImage() {
- return MediaImage(
- url: url,
- preload: preload,
- thumbnail: thumbnail,
- productHero: productHero,
- alt: alt,
- );
- }
-}
-
-
diff --git a/concierge/lib/domain/models/app_error.dart b/concierge/lib/domain/models/app_error.dart
new file mode 100644
index 00000000..df071517
--- /dev/null
+++ b/concierge/lib/domain/models/app_error.dart
@@ -0,0 +1,19 @@
+sealed class AppError {
+ const AppError();
+
+ static const none = None();
+
+ bool get isError => this is! None;
+
+ factory AppError.unknown(String message) => UnknownError(message);
+}
+
+final class None extends AppError {
+ const None() : super();
+}
+
+final class UnknownError extends AppError {
+ final String message;
+
+ const UnknownError(this.message);
+}
diff --git a/concierge/lib/domain/models/area_category.dart b/concierge/lib/domain/models/area_category.dart
deleted file mode 100644
index f813a6c5..00000000
--- a/concierge/lib/domain/models/area_category.dart
+++ /dev/null
@@ -1,15 +0,0 @@
-import 'area_sub_category.dart';
-
-class AreaCategory {
- final int id;
- final String name;
- final List<AreaSubCategory> subCategories;
-
- AreaCategory({
- required this.id,
- required this.name,
- required this.subCategories,
- });
-}
-
-
diff --git a/concierge/lib/domain/models/area_details.dart b/concierge/lib/domain/models/area_details.dart
deleted file mode 100644
index 20682cdc..00000000
--- a/concierge/lib/domain/models/area_details.dart
+++ /dev/null
@@ -1,50 +0,0 @@
-import 'package:concierge/domain/models/property_event.dart';
-
-import 'area_category.dart';
-import 'promotion.dart';
-
-class AreaDetails {
- final int id;
- final String name;
- final String pickupText;
- final String deliveryText;
- final bool isOpen;
- final bool isMeetingArea;
- final bool isGuestArea;
- final bool isPrearrivalArea;
- final String theme;
- final String icon;
- final int deliveryPrice;
- final bool isDeliveryDefault;
- final bool hasDelivery;
- final List<PropertyEvent> events;
- final bool skipLocation;
- final List<AreaCategory> categories;
- final Promotion promotion;
- final List<dynamic> deliveryTimes;
- final List<dynamic> supportItems;
-
- AreaDetails({
- required this.id,
- required this.name,
- required this.pickupText,
- required this.deliveryText,
- required this.isOpen,
- required this.isMeetingArea,
- required this.isGuestArea,
- required this.isPrearrivalArea,
- required this.theme,
- required this.icon,
- required this.deliveryPrice,
- required this.isDeliveryDefault,
- required this.hasDelivery,
- required this.events,
- required this.skipLocation,
- required this.categories,
- required this.promotion,
- required this.deliveryTimes,
- required this.supportItems,
- });
-}
-
-
diff --git a/concierge/lib/domain/models/area_sub_category.dart b/concierge/lib/domain/models/area_sub_category.dart
deleted file mode 100644
index f171cf1c..00000000
--- a/concierge/lib/domain/models/area_sub_category.dart
+++ /dev/null
@@ -1,23 +0,0 @@
-import 'media_image.dart';
-
-class AreaSubCategory {
- final int id;
- final String name;
- final String subTitle;
- final String heroTitle;
- final String description;
- final MediaImage heroImage;
- final List<int> products;
-
- AreaSubCategory({
- required this.id,
- required this.name,
- required this.subTitle,
- required this.heroTitle,
- required this.description,
- required this.heroImage,
- required this.products,
- });
-}
-
-
diff --git a/concierge/lib/domain/models/data_state.dart b/concierge/lib/domain/models/data_state.dart
new file mode 100644
index 00000000..b568fb99
--- /dev/null
+++ b/concierge/lib/domain/models/data_state.dart
@@ -0,0 +1,33 @@
+import 'app_error.dart';
+
+sealed class DataState {
+ const DataState();
+
+ static const initial = Initial();
+
+ static const loading = Loading();
+
+ static failure(AppError e) => Failure(e);
+
+ static success<T>(T data) => Success(data);
+}
+
+class Initial extends DataState {
+ const Initial();
+}
+
+class Loading extends DataState {
+ const Loading();
+}
+
+class Success<T> extends DataState {
+ final T data;
+
+ const Success(this.data);
+}
+
+class Failure extends DataState {
+ final AppError error;
+
+ const Failure(this.error);
+}
diff --git a/concierge/lib/domain/models/media_image.dart b/concierge/lib/domain/models/media_image.dart
deleted file mode 100644
index df940ae1..00000000
--- a/concierge/lib/domain/models/media_image.dart
+++ /dev/null
@@ -1,17 +0,0 @@
-class MediaImage {
- final String url;
- final String preload;
- final String thumbnail;
- final String productHero;
- final String alt;
-
- MediaImage({
- required this.url,
- required this.preload,
- required this.thumbnail,
- required this.productHero,
- required this.alt,
- });
-}
-
-
diff --git a/concierge/lib/domain/models/promotion.dart b/concierge/lib/domain/models/promotion.dart
deleted file mode 100644
index 83aca927..00000000
--- a/concierge/lib/domain/models/promotion.dart
+++ /dev/null
@@ -1,8 +0,0 @@
-class Promotion {
- final String title;
- final List<int> products;
-
- Promotion({required this.title, required this.products});
-}
-
-
diff --git a/concierge/lib/domain/models/property.dart b/concierge/lib/domain/models/property.dart
deleted file mode 100644
index 19f4ae60..00000000
--- a/concierge/lib/domain/models/property.dart
+++ /dev/null
@@ -1,42 +0,0 @@
-import 'media_image.dart';
-import 'property_area.dart';
-import 'property_intro.dart';
-import 'reject_message.dart';
-
-class Property {
- final int id;
- final String name;
- final String domain;
- final String languageCode;
- final String currency;
- final String hotline;
- final bool showInMenu;
- final String helpBody;
- final String? splashVideo;
- final List<PropertyArea> areas;
- final List<MediaImage> heroImages;
- final MediaImage logoImage;
- final MediaImage profileImage;
- final List<PropertyIntro> intros;
- final List<dynamic> menuItems;
- final List<RejectMessage> rejectMessages;
-
- Property({
- required this.id,
- required this.name,
- required this.domain,
- required this.languageCode,
- required this.currency,
- required this.hotline,
- required this.showInMenu,
- required this.helpBody,
- required this.splashVideo,
- required this.areas,
- required this.heroImages,
- required this.logoImage,
- required this.profileImage,
- required this.intros,
- required this.menuItems,
- required this.rejectMessages,
- });
-}
diff --git a/concierge/lib/domain/models/property_area.dart b/concierge/lib/domain/models/property_area.dart
deleted file mode 100644
index 95b7f014..00000000
--- a/concierge/lib/domain/models/property_area.dart
+++ /dev/null
@@ -1,39 +0,0 @@
-import 'property_event.dart';
-
-class PropertyArea {
- final int id;
- final String name;
- final String pickupText;
- final String deliveryText;
- final bool isOpen;
- final bool isMeetingArea;
- final bool isGuestArea;
- final bool isPrearrivalArea;
- final String theme;
- final String icon;
- final int deliveryPrice;
- final bool isDeliveryDefault;
- final bool hasDelivery;
- final List<PropertyEvent> events;
- final bool skipLocation;
-
- PropertyArea({
- required this.id,
- required this.name,
- required this.pickupText,
- required this.deliveryText,
- required this.isOpen,
- required this.isMeetingArea,
- required this.isGuestArea,
- required this.isPrearrivalArea,
- required this.theme,
- required this.icon,
- required this.deliveryPrice,
- required this.isDeliveryDefault,
- required this.hasDelivery,
- required this.events,
- required this.skipLocation,
- });
-}
-
-
diff --git a/concierge/lib/domain/models/property_event.dart b/concierge/lib/domain/models/property_event.dart
deleted file mode 100644
index 19b08d4c..00000000
--- a/concierge/lib/domain/models/property_event.dart
+++ /dev/null
@@ -1,19 +0,0 @@
-import 'media_image.dart';
-
-class PropertyEvent {
- final int id;
- final String title;
- final String subTitle;
- final String? ctaLink;
- final MediaImage heroImage;
-
- PropertyEvent({
- required this.id,
- required this.title,
- required this.subTitle,
- required this.ctaLink,
- required this.heroImage,
- });
-}
-
-
diff --git a/concierge/lib/domain/models/property_intro.dart b/concierge/lib/domain/models/property_intro.dart
deleted file mode 100644
index c1433a6c..00000000
--- a/concierge/lib/domain/models/property_intro.dart
+++ /dev/null
@@ -1,19 +0,0 @@
-import 'media_image.dart';
-
-class PropertyIntro {
- final int id;
- final String title;
- final String description;
- final String theme;
- final MediaImage heroImage;
-
- PropertyIntro({
- required this.id,
- required this.title,
- required this.description,
- required this.theme,
- required this.heroImage,
- });
-}
-
-
diff --git a/concierge/lib/domain/models/reject_message.dart b/concierge/lib/domain/models/reject_message.dart
deleted file mode 100644
index af1492e0..00000000
--- a/concierge/lib/domain/models/reject_message.dart
+++ /dev/null
@@ -1,8 +0,0 @@
-class RejectMessage {
- final String title;
- final String text;
-
- RejectMessage({required this.title, required this.text});
-}
-
-
diff --git a/concierge/lib/domain/repositories/property_repository.dart b/concierge/lib/domain/repositories/property_repository.dart
index 48709c78..7a45c61a 100644
--- a/concierge/lib/domain/repositories/property_repository.dart
+++ b/concierge/lib/domain/repositories/property_repository.dart
@@ -1,7 +1,66 @@
-import 'package:concierge/domain/models/property.dart';
+import 'package:concierge/data/remote/api/concierge_service.dart';
+import 'package:concierge/data/remote/models/area_details.dart';
+import 'package:concierge/data/remote/models/order.dart';
+import 'package:concierge/data/remote/models/order_review.dart';
+import 'package:concierge/data/remote/models/property.dart';
-abstract class PropertyRepository {
- Future<Property> getHotelOverview({required String hotelCode});
-}
+class PropertyRepository {
+ final ConciergeService _service;
+
+ const PropertyRepository(this._service);
+
+ Future<Property> getHotelOverview({required String hotelCode}) async {
+ final response = await _service.getHotelOverview(hotelCode);
+ return response.data;
+ }
+
+ Future<AreaDetails> getArea(int areaId) async {
+ final response = await _service.getArea(areaId);
+ return response.data;
+ }
+ Future<Order> createOrder() async {
+ final body = {
+ "area_id": 70,
+ "location_code": "0001",
+ "delivery": true,
+ "requested_delivery_time": "12:30",
+ "payment_type": "WAITER",
+ "full_name": null,
+ "customer_id": 37026,
+ "customer_name": "King",
+ "customer_comment": "",
+ "order_type": "PRODUCT",
+ "ga_client_id": "GA1.2.1247178081.1736166148",
+ };
+ final response = await _service.createOrder(body);
+ return response.data;
+ }
+ Future<OrderReview> reviewOrder() async {
+ final body = {
+ "area_id": 46,
+ "location_code": "null",
+ "delivery": true,
+ "requested_delivery_time": "ASAP",
+ "payment_type": "null",
+ "full_name": "null",
+ "customer_id": "null",
+ "customer_name": "",
+ "customer_comment": "",
+ "order_type": "PRODUCT",
+ };
+ final response = await _service.getOrderReview(body);
+ return response.data;
+ }
+
+ Future<Order> getOrder(String id) async {
+ final response = await _service.getOrder(id);
+ return response.data;
+ }
+
+ Future<List<Order>> getAllOrders() async {
+ final response = await _service.getCustomerOrders();
+ return response.data;
+ }
+}
diff --git a/concierge/lib/flavors.dart b/concierge/lib/flavors.dart
index 3ffa0e21..7ae53dff 100644
--- a/concierge/lib/flavors.dart
+++ b/concierge/lib/flavors.dart
@@ -4,16 +4,22 @@ enum Flavor {
}
class F {
- static late final Flavor appFlavor;
+ static Flavor? _appFlavor;
+
+ static Flavor get appFlavor => _appFlavor!;
+
+ static set appFlavor(Flavor flavor) {
+ _appFlavor = flavor;
+ }
static String get name => appFlavor.name;
static String get title {
switch (appFlavor) {
case Flavor.stage:
- return 'LuxPlus [DEV]';
+ return 'Comvwell Concierge [DEV]';
case Flavor.production:
- return 'Luxplus';
+ return 'Comvwell Concierge';
}
}
@@ -25,4 +31,9 @@ class F {
return "dotenv/.production.env";
}
}
+
+ static String get baseUrl => switch (appFlavor) {
+ Flavor.stage => "https://admin-stage.concierge.comwell.com/api/da/",
+ Flavor.production => "https://admin.concierge.comwell.com/api/da/",
+ };
}
diff --git a/concierge/lib/presentation/app/concierge_hotel_overview.dart b/concierge/lib/presentation/app/concierge_hotel_overview.dart
deleted file mode 100644
index 40a6e10e..00000000
--- a/concierge/lib/presentation/app/concierge_hotel_overview.dart
+++ /dev/null
@@ -1,42 +0,0 @@
-import 'package:concierge/concierge_config.dart';
-import 'package:concierge/data/local/secure_storage/concierge_secure_storage.dart';
-import 'package:concierge/di/getit.dart';
-import 'package:concierge/presentation/screens/hotel_overview_page/bloc/hotel_overview_page_cubit.dart';
-import 'package:concierge/presentation/screens/hotel_overview_page/hotel_overview_page_screen.dart';
-import 'package:flutter/material.dart';
-import 'package:flutter_bloc/flutter_bloc.dart';
-
-/// Entry widget to embed the Concierge hotel overview screen in a host app.
-/// The host app must pass [hotelCode] and [userToken] (and baseUrl) when opening the plugin.
-class ConciergeHotelOverview extends StatefulWidget {
- final ConciergeConfig config;
-
- const ConciergeHotelOverview({super.key, required this.config});
-
- @override
- State<ConciergeHotelOverview> createState() => _ConciergeHotelOverviewState();
-}
-
-class _ConciergeHotelOverviewState extends State<ConciergeHotelOverview> {
- @override
- void initState() {
- super.initState();
- setupDependencies(widget.config);
-
- // Token is NOT used for Concierge API calls; we only persist it for later use.
- final token = widget.config.userToken;
- if (token != null && token.isNotEmpty) {
- getIt<ConciergeSecureStorage>().setUserToken(token);
- }
- }
-
- @override
- Widget build(BuildContext context) {
- return BlocProvider(
- create: (_) => HotelOverviewPageCubit(),
- child: const HotelOverviewPageScreen(),
- );
- }
-}
-
-
diff --git a/concierge/lib/presentation/navigation/app_routes.dart b/concierge/lib/presentation/navigation/app_routes.dart
index 9a467268..113dfe69 100644
--- a/concierge/lib/presentation/navigation/app_routes.dart
+++ b/concierge/lib/presentation/navigation/app_routes.dart
@@ -1,7 +1,3 @@
-class AppRoutes {
- const AppRoutes._();
-
-
- static const hotelOverviewPage = "/";
-
-}
\ No newline at end of file
+abstract class AppRoutes {
+ static const hotelOverviewPage = "/hotel-overview-page";
+}
diff --git a/concierge/lib/presentation/navigation/router.dart b/concierge/lib/presentation/navigation/router.dart
index 9a92725b..397b364a 100644
--- a/concierge/lib/presentation/navigation/router.dart
+++ b/concierge/lib/presentation/navigation/router.dart
@@ -7,22 +7,20 @@ import 'package:go_router/go_router.dart';
import '../screens/hotel_overview_page/hotel_overview_page_route.dart';
final rootNavigatorKey = GlobalKey<NavigatorState>();
-final bottomNavNavigatorKey = GlobalKey<NavigatorState>();
-final filterNavigatorKey = GlobalKey<NavigatorState>();
-
-
-final router = GoRouter(
+GoRouter router() => GoRouter(
navigatorKey: rootNavigatorKey,
- observers:[],
+ observers: [],
initialLocation: AppRoutes.hotelOverviewPage,
debugLogDiagnostics: kDebugMode,
redirect: (context, state) {
final uri = state.uri;
debugPrint("qqq uri=$uri");
+ // will exit app
+ if (state.matchedLocation == "/exit") context.pop();
return null;
},
routes: [
- $hotelOverviewPageRoute,
+ $hotelOverviewPageRoute,
],
-);
\ No newline at end of file
+);
diff --git a/concierge/lib/presentation/screens/hotel_overview_page/bloc/hotel_overview_page_cubit.dart b/concierge/lib/presentation/screens/hotel_overview_page/bloc/hotel_overview_page_cubit.dart
index 6dc2dd69..01acf044 100644
--- a/concierge/lib/presentation/screens/hotel_overview_page/bloc/hotel_overview_page_cubit.dart
+++ b/concierge/lib/presentation/screens/hotel_overview_page/bloc/hotel_overview_page_cubit.dart
@@ -1,34 +1,60 @@
+import 'package:concierge/domain/models/app_error.dart';
+import 'package:concierge/domain/models/data_state.dart';
+import 'package:concierge/domain/repositories/property_repository.dart';
import 'package:concierge/presentation/base/base_cubit.dart';
import 'package:concierge/presentation/screens/hotel_overview_page/bloc/hotel_overview_page_state.dart';
-import 'package:concierge/di/getit.dart';
-import 'package:concierge/concierge_config.dart';
-import 'package:concierge/domain/repositories/property_repository.dart';
class HotelOverviewPageCubit extends BaseCubit<HotelOverviewPageState> {
- HotelOverviewPageCubit() : super(const HotelOverviewPageState()) {
+ final String hotelCode;
+ final PropertyRepository _propertyRepository;
+
+ HotelOverviewPageCubit(this._propertyRepository, {required this.hotelCode})
+ : super(const HotelOverviewPageState()) {
init();
}
Future<void> init() async {
- safeEmit(state.copyWith(isLoading: true, errorMessage: ""));
try {
- final repo = getIt<PropertyRepository>();
- final config = getIt<ConciergeConfig>();
- final property = await repo.getHotelOverview(hotelCode: config.hotelCode);
- final firstAreaId =
- property.areas.isNotEmpty ? property.areas.first.id : null;
- safeEmit(state.copyWith(
- isLoading: false,
- property: property,
- selectedAreaId: firstAreaId,
- ));
+ safeEmit(state.copyWith(isLoading: true, errorMessage: ""));
+ final property = await _propertyRepository.getHotelOverview(hotelCode: hotelCode);
+ final firstAreaId = property.areas.isNotEmpty ? property.areas.first.id : 0;
+ safeEmit(state.copyWith(property: property));
+ selectAreaId(firstAreaId);
} catch (e, st) {
handleError(e, st);
- safeEmit(state.copyWith(isLoading: false, errorMessage: e.toString()));
+ safeEmit(state.copyWith(errorMessage: e.toString()));
+ } finally {
+ safeEmit(state.copyWith(isLoading: false));
}
}
void selectAreaId(int areaId) {
safeEmit(state.copyWith(selectedAreaId: areaId));
+ if (state.areas[areaId] == null) {
+ loadArea(areaId);
+ }
+ }
+
+ Future<void> loadArea(int areaId) async {
+ try {
+ _updateAreaDataState(areaId, DataState.loading);
+ final response = await _propertyRepository.getArea(areaId);
+ _updateAreaDataState(areaId, DataState.success(response));
+ } catch (e, st) {
+ handleError(e, st);
+ _updateAreaDataState(areaId, DataState.failure(AppError.unknown(e.toString())));
+ }
+ }
+
+ void _updateAreaDataState(int areaId, DataState dataState) {
+ final copy = Map.of(state.areas);
+ copy[areaId] = dataState;
+ safeEmit(state.copyWith(areas: copy));
+ }
+
+ DataState get areaState {
+ final area = state.areas[state.selectedAreaId];
+ if (area == null) return DataState.loading;
+ return area;
}
}
diff --git a/concierge/lib/presentation/screens/hotel_overview_page/bloc/hotel_overview_page_state.dart b/concierge/lib/presentation/screens/hotel_overview_page/bloc/hotel_overview_page_state.dart
index 4ace40a1..4050446b 100644
--- a/concierge/lib/presentation/screens/hotel_overview_page/bloc/hotel_overview_page_state.dart
+++ b/concierge/lib/presentation/screens/hotel_overview_page/bloc/hotel_overview_page_state.dart
@@ -1,7 +1,8 @@
+import 'package:concierge/data/remote/models/area_details.dart';
+import 'package:concierge/data/remote/models/property.dart';
+import 'package:concierge/domain/models/data_state.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'package:concierge/domain/models/property.dart';
-
part '../../../../_generated/presentation/screens/hotel_overview_page/bloc/hotel_overview_page_state.freezed.dart';
@freezed
@@ -9,7 +10,8 @@ abstract class HotelOverviewPageState with _$HotelOverviewPageState {
const factory HotelOverviewPageState({
@Default(false) bool isLoading,
@Default("") String errorMessage,
+ @Default(0) int selectedAreaId,
+ @Default({}) Map<int, DataState> areas,
Property? property,
- int? selectedAreaId,
}) = _HotelOverviewPageState;
}
\ No newline at end of file
diff --git a/concierge/lib/presentation/screens/hotel_overview_page/hotel_overview_page_route.dart b/concierge/lib/presentation/screens/hotel_overview_page/hotel_overview_page_route.dart
index 801b704c..708bd672 100644
--- a/concierge/lib/presentation/screens/hotel_overview_page/hotel_overview_page_route.dart
+++ b/concierge/lib/presentation/screens/hotel_overview_page/hotel_overview_page_route.dart
@@ -8,19 +8,17 @@ import 'package:concierge/presentation/screens/hotel_overview_page/hotel_overvie
part '../../../_generated/presentation/screens/hotel_overview_page/hotel_overview_page_route.g.dart';
-@TypedGoRoute<HotelOverviewPageRoute>(
- path: "/hotel-overview-page", // add me to AppRoutes: static const hotelOverviewPage = "/hotel-overview-page";
-)
+@TypedGoRoute<HotelOverviewPageRoute>(path: AppRoutes.hotelOverviewPage)
class HotelOverviewPageRoute extends GoRouteData with $HotelOverviewPageRoute {
-
@override
Page<void> buildPage(BuildContext context, GoRouterState state) {
return slideUpTransition(
state: state,
- child: BlocProvider(
- create: (context) => HotelOverviewPageCubit(),
+ child: PopScope(
+ canPop: context.canPop(),
+ onPopInvokedWithResult: (didPop, result) {},
child: HotelOverviewPageScreen(),
),
);
}
-}
\ No newline at end of file
+}
diff --git a/concierge/lib/presentation/screens/hotel_overview_page/hotel_overview_page_screen.dart b/concierge/lib/presentation/screens/hotel_overview_page/hotel_overview_page_screen.dart
index 55335512..37b04827 100644
--- a/concierge/lib/presentation/screens/hotel_overview_page/hotel_overview_page_screen.dart
+++ b/concierge/lib/presentation/screens/hotel_overview_page/hotel_overview_page_screen.dart
@@ -1,3 +1,5 @@
+import 'package:concierge/data/remote/models/area_details.dart';
+import 'package:concierge/domain/models/data_state.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:concierge/presentation/screens/hotel_overview_page/bloc/hotel_overview_page_cubit.dart';
@@ -17,10 +19,8 @@ class HotelOverviewPageScreen extends StatelessWidget {
BlocListener<HotelOverviewPageCubit, HotelOverviewPageState>(
listenWhen: (prev, curr) =>
prev.isLoading && !curr.isLoading && curr.errorMessage.isNotEmpty,
- listener: (context, state) {
-
- },
- )
+ listener: (context, state) {},
+ ),
],
child: Scaffold(
appBar: HotelOverviewAppBar(
@@ -30,16 +30,26 @@ class HotelOverviewPageScreen extends StatelessWidget {
cubit.selectAreaId(area.id);
},
),
- body: Center(
- child: Column(
- children: [
-
- ],
- ),
+ body: Builder(
+ builder: (context) {
+ final areaState = cubit.areaState;
+ if (areaState is Loading || areaState is Initial) {
+ return Center(child: CircularProgressIndicator());
+ }
+ if (areaState is Failure) {
+ return Center(child: Text((areaState).error.toString()));
+ }
+ final areaDetails = (areaState as Success<AreaDetails>).data;
+ return SingleChildScrollView(
+ child: Column(
+ children: [Text(areaDetails.toJson().toString())],
+ ),
+ );
+ },
),
),
);
},
);
- }
-}
\ No newline at end of file
+ }
+}
diff --git a/concierge/lib/presentation/widgets/hotel_overview_app_bar.dart b/concierge/lib/presentation/widgets/hotel_overview_app_bar.dart
index 32017298..e1390620 100644
--- a/concierge/lib/presentation/widgets/hotel_overview_app_bar.dart
+++ b/concierge/lib/presentation/widgets/hotel_overview_app_bar.dart
@@ -1,8 +1,8 @@
+import 'package:concierge/data/remote/models/property_area.dart';
import 'package:concierge/presentation/navigation/app_routes.dart';
import 'package:concierge/presentation/theme/app_colors.dart';
import 'package:concierge/presentation/theme/app_textstyles.dart';
import 'package:concierge/presentation/widgets/round_icon_button.dart';
-import 'package:concierge/domain/models/property_area.dart';
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:go_router/go_router.dart';
@@ -43,9 +43,7 @@ class HotelOverviewAppBar extends StatelessWidget implements PreferredSizeWidget
bool _isHttpUrl(String value) {
final uri = Uri.tryParse(value);
- return uri != null &&
- uri.hasAbsolutePath &&
- (uri.scheme == 'http' || uri.scheme == 'https');
+ return uri != null && uri.hasAbsolutePath && (uri.scheme == 'http' || uri.scheme == 'https');
}
String? _areaIconUrl(PropertyArea area) {
@@ -169,6 +167,8 @@ class HotelOverviewAppBar extends StatelessWidget implements PreferredSizeWidget
final goRouter = GoRouter.of(context);
if (goRouter.canPop()) {
context.pop();
+ } else if (goRouter.state.matchedLocation == AppRoutes.hotelOverviewPage) {
+ context.go("/exit");
} else {
context.go(AppRoutes.hotelOverviewPage);
}
@@ -204,25 +204,21 @@ class HotelOverviewAppBar extends StatelessWidget implements PreferredSizeWidget
const spacing = 10.0;
const horizontalPadding = 16.0; // 8 left + 8 right
- final requiredWidth = (areas.length * _areaItemWidth) +
+ final requiredWidth =
+ (areas.length * _areaItemWidth) +
((areas.length - 1) * spacing) +
horizontalPadding;
final fitsWithoutScroll = requiredWidth <= constraints.maxWidth;
Widget buildItem(PropertyArea area) {
- final isSelected =
- selectedAreaId != null && area.id == selectedAreaId;
- final unselectedColor =
- AppColors.colorPrimaryText.withValues(alpha: 0.35);
+ final isSelected = selectedAreaId != null && area.id == selectedAreaId;
+ final unselectedColor = AppColors.colorPrimaryText.withValues(alpha: 0.35);
final selectedColor = AppColors.sandColor[100]!;
- final tintColor =
- isSelected ? selectedColor : unselectedColor;
+ final tintColor = isSelected ? selectedColor : unselectedColor;
return InkWell(
borderRadius: BorderRadius.circular(12),
- onTap: onAreaPressed == null
- ? null
- : () => onAreaPressed!(area),
+ onTap: onAreaPressed == null ? null : () => onAreaPressed!(area),
child: SizedBox(
width: _areaItemWidth,
height: _areaItemHeight,
@@ -233,8 +229,7 @@ class HotelOverviewAppBar extends StatelessWidget implements PreferredSizeWidget
SizedBox(
height: 24,
width: 24,
- child:
- _buildAreaIcon(area, tintColor: tintColor),
+ child: _buildAreaIcon(area, tintColor: tintColor),
),
const Gap(4),
SizedBox(
@@ -262,8 +257,7 @@ class HotelOverviewAppBar extends StatelessWidget implements PreferredSizeWidget
children: [
for (var i = 0; i < areas.length; i++) ...[
buildItem(areas[i]),
- if (i != areas.length - 1)
- const SizedBox(width: spacing),
+ if (i != areas.length - 1) const SizedBox(width: spacing),
],
],
),
@@ -290,8 +284,5 @@ class HotelOverviewAppBar extends StatelessWidget implements PreferredSizeWidget
}
@override
- Size get preferredSize =>
- Size.fromHeight(shouldShowAppBar ? height : 0);
+ Size get preferredSize => Size.fromHeight(shouldShowAppBar ? height : 0);
}
-
-