diff --git a/lib/application/analytic/inventory_analytic_loader/inventory_analytic_loader_bloc.dart b/lib/application/analytic/inventory_analytic_loader/inventory_analytic_loader_bloc.dart new file mode 100644 index 0000000..c5fbcd6 --- /dev/null +++ b/lib/application/analytic/inventory_analytic_loader/inventory_analytic_loader_bloc.dart @@ -0,0 +1,47 @@ +import 'package:bloc/bloc.dart'; +import 'package:dartz/dartz.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:injectable/injectable.dart'; + +import '../../../domain/analytic/analytic.dart'; + +part 'inventory_analytic_loader_event.dart'; +part 'inventory_analytic_loader_state.dart'; +part 'inventory_analytic_loader_bloc.freezed.dart'; + +@injectable +class InventoryAnalyticLoaderBloc + extends Bloc { + final IAnalyticRepository _analyticRepository; + InventoryAnalyticLoaderBloc(this._analyticRepository) + : super(InventoryAnalyticLoaderState.initial()) { + on(_onInventoryAnalyticLoaderEvent); + } + + Future _onInventoryAnalyticLoaderEvent( + InventoryAnalyticLoaderEvent event, + Emitter emit, + ) { + return event.map( + fetched: (e) async { + emit(state.copyWith(isFetching: true, failureOption: none())); + + final result = await _analyticRepository.getInventory( + dateFrom: e.startDate, + dateTo: e.endDate, + ); + + emit( + result.fold( + (l) => state.copyWith(isFetching: false, failureOption: some(l)), + (r) => state.copyWith( + isFetching: false, + failureOption: none(), + inventoryAnalytic: r, + ), + ), + ); + }, + ); + } +} diff --git a/lib/application/analytic/inventory_analytic_loader/inventory_analytic_loader_bloc.freezed.dart b/lib/application/analytic/inventory_analytic_loader/inventory_analytic_loader_bloc.freezed.dart new file mode 100644 index 0000000..a6e9094 --- /dev/null +++ b/lib/application/analytic/inventory_analytic_loader/inventory_analytic_loader_bloc.freezed.dart @@ -0,0 +1,480 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'inventory_analytic_loader_bloc.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models', +); + +/// @nodoc +mixin _$InventoryAnalyticLoaderEvent { + DateTime get startDate => throw _privateConstructorUsedError; + DateTime get endDate => throw _privateConstructorUsedError; + @optionalTypeArgs + TResult when({ + required TResult Function(DateTime startDate, DateTime endDate) fetched, + }) => throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(DateTime startDate, DateTime endDate)? fetched, + }) => throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(DateTime startDate, DateTime endDate)? fetched, + required TResult orElse(), + }) => throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(_Fetched value) fetched, + }) => throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(_Fetched value)? fetched, + }) => throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(_Fetched value)? fetched, + required TResult orElse(), + }) => throw _privateConstructorUsedError; + + /// Create a copy of InventoryAnalyticLoaderEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $InventoryAnalyticLoaderEventCopyWith + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $InventoryAnalyticLoaderEventCopyWith<$Res> { + factory $InventoryAnalyticLoaderEventCopyWith( + InventoryAnalyticLoaderEvent value, + $Res Function(InventoryAnalyticLoaderEvent) then, + ) = + _$InventoryAnalyticLoaderEventCopyWithImpl< + $Res, + InventoryAnalyticLoaderEvent + >; + @useResult + $Res call({DateTime startDate, DateTime endDate}); +} + +/// @nodoc +class _$InventoryAnalyticLoaderEventCopyWithImpl< + $Res, + $Val extends InventoryAnalyticLoaderEvent +> + implements $InventoryAnalyticLoaderEventCopyWith<$Res> { + _$InventoryAnalyticLoaderEventCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of InventoryAnalyticLoaderEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? startDate = null, Object? endDate = null}) { + return _then( + _value.copyWith( + startDate: null == startDate + ? _value.startDate + : startDate // ignore: cast_nullable_to_non_nullable + as DateTime, + endDate: null == endDate + ? _value.endDate + : endDate // ignore: cast_nullable_to_non_nullable + as DateTime, + ) + as $Val, + ); + } +} + +/// @nodoc +abstract class _$$FetchedImplCopyWith<$Res> + implements $InventoryAnalyticLoaderEventCopyWith<$Res> { + factory _$$FetchedImplCopyWith( + _$FetchedImpl value, + $Res Function(_$FetchedImpl) then, + ) = __$$FetchedImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({DateTime startDate, DateTime endDate}); +} + +/// @nodoc +class __$$FetchedImplCopyWithImpl<$Res> + extends _$InventoryAnalyticLoaderEventCopyWithImpl<$Res, _$FetchedImpl> + implements _$$FetchedImplCopyWith<$Res> { + __$$FetchedImplCopyWithImpl( + _$FetchedImpl _value, + $Res Function(_$FetchedImpl) _then, + ) : super(_value, _then); + + /// Create a copy of InventoryAnalyticLoaderEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? startDate = null, Object? endDate = null}) { + return _then( + _$FetchedImpl( + startDate: null == startDate + ? _value.startDate + : startDate // ignore: cast_nullable_to_non_nullable + as DateTime, + endDate: null == endDate + ? _value.endDate + : endDate // ignore: cast_nullable_to_non_nullable + as DateTime, + ), + ); + } +} + +/// @nodoc + +class _$FetchedImpl implements _Fetched { + const _$FetchedImpl({required this.startDate, required this.endDate}); + + @override + final DateTime startDate; + @override + final DateTime endDate; + + @override + String toString() { + return 'InventoryAnalyticLoaderEvent.fetched(startDate: $startDate, endDate: $endDate)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$FetchedImpl && + (identical(other.startDate, startDate) || + other.startDate == startDate) && + (identical(other.endDate, endDate) || other.endDate == endDate)); + } + + @override + int get hashCode => Object.hash(runtimeType, startDate, endDate); + + /// Create a copy of InventoryAnalyticLoaderEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$FetchedImplCopyWith<_$FetchedImpl> get copyWith => + __$$FetchedImplCopyWithImpl<_$FetchedImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(DateTime startDate, DateTime endDate) fetched, + }) { + return fetched(startDate, endDate); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(DateTime startDate, DateTime endDate)? fetched, + }) { + return fetched?.call(startDate, endDate); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(DateTime startDate, DateTime endDate)? fetched, + required TResult orElse(), + }) { + if (fetched != null) { + return fetched(startDate, endDate); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(_Fetched value) fetched, + }) { + return fetched(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(_Fetched value)? fetched, + }) { + return fetched?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(_Fetched value)? fetched, + required TResult orElse(), + }) { + if (fetched != null) { + return fetched(this); + } + return orElse(); + } +} + +abstract class _Fetched implements InventoryAnalyticLoaderEvent { + const factory _Fetched({ + required final DateTime startDate, + required final DateTime endDate, + }) = _$FetchedImpl; + + @override + DateTime get startDate; + @override + DateTime get endDate; + + /// Create a copy of InventoryAnalyticLoaderEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$FetchedImplCopyWith<_$FetchedImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +mixin _$InventoryAnalyticLoaderState { + InventoryAnalytic get inventoryAnalytic => throw _privateConstructorUsedError; + Option get failureOption => + throw _privateConstructorUsedError; + bool get isFetching => throw _privateConstructorUsedError; + + /// Create a copy of InventoryAnalyticLoaderState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $InventoryAnalyticLoaderStateCopyWith + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $InventoryAnalyticLoaderStateCopyWith<$Res> { + factory $InventoryAnalyticLoaderStateCopyWith( + InventoryAnalyticLoaderState value, + $Res Function(InventoryAnalyticLoaderState) then, + ) = + _$InventoryAnalyticLoaderStateCopyWithImpl< + $Res, + InventoryAnalyticLoaderState + >; + @useResult + $Res call({ + InventoryAnalytic inventoryAnalytic, + Option failureOption, + bool isFetching, + }); + + $InventoryAnalyticCopyWith<$Res> get inventoryAnalytic; +} + +/// @nodoc +class _$InventoryAnalyticLoaderStateCopyWithImpl< + $Res, + $Val extends InventoryAnalyticLoaderState +> + implements $InventoryAnalyticLoaderStateCopyWith<$Res> { + _$InventoryAnalyticLoaderStateCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of InventoryAnalyticLoaderState + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? inventoryAnalytic = null, + Object? failureOption = null, + Object? isFetching = null, + }) { + return _then( + _value.copyWith( + inventoryAnalytic: null == inventoryAnalytic + ? _value.inventoryAnalytic + : inventoryAnalytic // ignore: cast_nullable_to_non_nullable + as InventoryAnalytic, + failureOption: null == failureOption + ? _value.failureOption + : failureOption // ignore: cast_nullable_to_non_nullable + as Option, + isFetching: null == isFetching + ? _value.isFetching + : isFetching // ignore: cast_nullable_to_non_nullable + as bool, + ) + as $Val, + ); + } + + /// Create a copy of InventoryAnalyticLoaderState + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $InventoryAnalyticCopyWith<$Res> get inventoryAnalytic { + return $InventoryAnalyticCopyWith<$Res>(_value.inventoryAnalytic, (value) { + return _then(_value.copyWith(inventoryAnalytic: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$InventoryAnalyticLoaderStateImplCopyWith<$Res> + implements $InventoryAnalyticLoaderStateCopyWith<$Res> { + factory _$$InventoryAnalyticLoaderStateImplCopyWith( + _$InventoryAnalyticLoaderStateImpl value, + $Res Function(_$InventoryAnalyticLoaderStateImpl) then, + ) = __$$InventoryAnalyticLoaderStateImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({ + InventoryAnalytic inventoryAnalytic, + Option failureOption, + bool isFetching, + }); + + @override + $InventoryAnalyticCopyWith<$Res> get inventoryAnalytic; +} + +/// @nodoc +class __$$InventoryAnalyticLoaderStateImplCopyWithImpl<$Res> + extends + _$InventoryAnalyticLoaderStateCopyWithImpl< + $Res, + _$InventoryAnalyticLoaderStateImpl + > + implements _$$InventoryAnalyticLoaderStateImplCopyWith<$Res> { + __$$InventoryAnalyticLoaderStateImplCopyWithImpl( + _$InventoryAnalyticLoaderStateImpl _value, + $Res Function(_$InventoryAnalyticLoaderStateImpl) _then, + ) : super(_value, _then); + + /// Create a copy of InventoryAnalyticLoaderState + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? inventoryAnalytic = null, + Object? failureOption = null, + Object? isFetching = null, + }) { + return _then( + _$InventoryAnalyticLoaderStateImpl( + inventoryAnalytic: null == inventoryAnalytic + ? _value.inventoryAnalytic + : inventoryAnalytic // ignore: cast_nullable_to_non_nullable + as InventoryAnalytic, + failureOption: null == failureOption + ? _value.failureOption + : failureOption // ignore: cast_nullable_to_non_nullable + as Option, + isFetching: null == isFetching + ? _value.isFetching + : isFetching // ignore: cast_nullable_to_non_nullable + as bool, + ), + ); + } +} + +/// @nodoc + +class _$InventoryAnalyticLoaderStateImpl + implements _InventoryAnalyticLoaderState { + _$InventoryAnalyticLoaderStateImpl({ + required this.inventoryAnalytic, + required this.failureOption, + this.isFetching = false, + }); + + @override + final InventoryAnalytic inventoryAnalytic; + @override + final Option failureOption; + @override + @JsonKey() + final bool isFetching; + + @override + String toString() { + return 'InventoryAnalyticLoaderState(inventoryAnalytic: $inventoryAnalytic, failureOption: $failureOption, isFetching: $isFetching)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$InventoryAnalyticLoaderStateImpl && + (identical(other.inventoryAnalytic, inventoryAnalytic) || + other.inventoryAnalytic == inventoryAnalytic) && + (identical(other.failureOption, failureOption) || + other.failureOption == failureOption) && + (identical(other.isFetching, isFetching) || + other.isFetching == isFetching)); + } + + @override + int get hashCode => + Object.hash(runtimeType, inventoryAnalytic, failureOption, isFetching); + + /// Create a copy of InventoryAnalyticLoaderState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$InventoryAnalyticLoaderStateImplCopyWith< + _$InventoryAnalyticLoaderStateImpl + > + get copyWith => + __$$InventoryAnalyticLoaderStateImplCopyWithImpl< + _$InventoryAnalyticLoaderStateImpl + >(this, _$identity); +} + +abstract class _InventoryAnalyticLoaderState + implements InventoryAnalyticLoaderState { + factory _InventoryAnalyticLoaderState({ + required final InventoryAnalytic inventoryAnalytic, + required final Option failureOption, + final bool isFetching, + }) = _$InventoryAnalyticLoaderStateImpl; + + @override + InventoryAnalytic get inventoryAnalytic; + @override + Option get failureOption; + @override + bool get isFetching; + + /// Create a copy of InventoryAnalyticLoaderState + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$InventoryAnalyticLoaderStateImplCopyWith< + _$InventoryAnalyticLoaderStateImpl + > + get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/application/analytic/inventory_analytic_loader/inventory_analytic_loader_event.dart b/lib/application/analytic/inventory_analytic_loader/inventory_analytic_loader_event.dart new file mode 100644 index 0000000..10c2c18 --- /dev/null +++ b/lib/application/analytic/inventory_analytic_loader/inventory_analytic_loader_event.dart @@ -0,0 +1,9 @@ +part of 'inventory_analytic_loader_bloc.dart'; + +@freezed +class InventoryAnalyticLoaderEvent with _$InventoryAnalyticLoaderEvent { + const factory InventoryAnalyticLoaderEvent.fetched({ + required DateTime startDate, + required DateTime endDate, + }) = _Fetched; +} diff --git a/lib/application/analytic/inventory_analytic_loader/inventory_analytic_loader_state.dart b/lib/application/analytic/inventory_analytic_loader/inventory_analytic_loader_state.dart new file mode 100644 index 0000000..40fc91a --- /dev/null +++ b/lib/application/analytic/inventory_analytic_loader/inventory_analytic_loader_state.dart @@ -0,0 +1,16 @@ +part of 'inventory_analytic_loader_bloc.dart'; + +@freezed +class InventoryAnalyticLoaderState with _$InventoryAnalyticLoaderState { + factory InventoryAnalyticLoaderState({ + required InventoryAnalytic inventoryAnalytic, + required Option failureOption, + @Default(false) bool isFetching, + }) = _InventoryAnalyticLoaderState; + + factory InventoryAnalyticLoaderState.initial() => + InventoryAnalyticLoaderState( + inventoryAnalytic: InventoryAnalytic.empty(), + failureOption: none(), + ); +} diff --git a/lib/common/url/api_path.dart b/lib/common/url/api_path.dart index cde8c8b..216dbea 100644 --- a/lib/common/url/api_path.dart +++ b/lib/common/url/api_path.dart @@ -15,4 +15,5 @@ class ApiPath { '/api/v1/analytics/payment-methods'; static const String analyticProfitLoss = '/api/v1/analytics/profit-loss'; static const String analyticCategories = '/api/v1/analytics/categories'; + static const String analyticInventory = '/api/v1/inventory/report/details'; } diff --git a/lib/domain/analytic/analytic.dart b/lib/domain/analytic/analytic.dart index 32f0f10..986b5dc 100644 --- a/lib/domain/analytic/analytic.dart +++ b/lib/domain/analytic/analytic.dart @@ -11,5 +11,6 @@ part 'entities/product_analytic_entity.dart'; part 'entities/payment_method_analytic_entity.dart'; part 'entities/profit_loss_analytic_entity.dart'; part 'entities/category_analytic_entity.dart'; +part 'entities/inventory_analytic_entity.dart'; part 'failures/analytic_failure.dart'; part 'repositories/i_analytic_repository.dart'; diff --git a/lib/domain/analytic/analytic.freezed.dart b/lib/domain/analytic/analytic.freezed.dart index 9ac8695..4145c13 100644 --- a/lib/domain/analytic/analytic.freezed.dart +++ b/lib/domain/analytic/analytic.freezed.dart @@ -5866,6 +5866,1490 @@ abstract class _CategoryAnalyticItem implements CategoryAnalyticItem { get copyWith => throw _privateConstructorUsedError; } +/// @nodoc +mixin _$InventoryAnalytic { + InventoryAnalyticSummary get summary => throw _privateConstructorUsedError; + List get products => + throw _privateConstructorUsedError; + List get ingredients => + throw _privateConstructorUsedError; + + /// Create a copy of InventoryAnalytic + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $InventoryAnalyticCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $InventoryAnalyticCopyWith<$Res> { + factory $InventoryAnalyticCopyWith( + InventoryAnalytic value, + $Res Function(InventoryAnalytic) then, + ) = _$InventoryAnalyticCopyWithImpl<$Res, InventoryAnalytic>; + @useResult + $Res call({ + InventoryAnalyticSummary summary, + List products, + List ingredients, + }); + + $InventoryAnalyticSummaryCopyWith<$Res> get summary; +} + +/// @nodoc +class _$InventoryAnalyticCopyWithImpl<$Res, $Val extends InventoryAnalytic> + implements $InventoryAnalyticCopyWith<$Res> { + _$InventoryAnalyticCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of InventoryAnalytic + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? summary = null, + Object? products = null, + Object? ingredients = null, + }) { + return _then( + _value.copyWith( + summary: null == summary + ? _value.summary + : summary // ignore: cast_nullable_to_non_nullable + as InventoryAnalyticSummary, + products: null == products + ? _value.products + : products // ignore: cast_nullable_to_non_nullable + as List, + ingredients: null == ingredients + ? _value.ingredients + : ingredients // ignore: cast_nullable_to_non_nullable + as List, + ) + as $Val, + ); + } + + /// Create a copy of InventoryAnalytic + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $InventoryAnalyticSummaryCopyWith<$Res> get summary { + return $InventoryAnalyticSummaryCopyWith<$Res>(_value.summary, (value) { + return _then(_value.copyWith(summary: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$InventoryAnalyticImplCopyWith<$Res> + implements $InventoryAnalyticCopyWith<$Res> { + factory _$$InventoryAnalyticImplCopyWith( + _$InventoryAnalyticImpl value, + $Res Function(_$InventoryAnalyticImpl) then, + ) = __$$InventoryAnalyticImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({ + InventoryAnalyticSummary summary, + List products, + List ingredients, + }); + + @override + $InventoryAnalyticSummaryCopyWith<$Res> get summary; +} + +/// @nodoc +class __$$InventoryAnalyticImplCopyWithImpl<$Res> + extends _$InventoryAnalyticCopyWithImpl<$Res, _$InventoryAnalyticImpl> + implements _$$InventoryAnalyticImplCopyWith<$Res> { + __$$InventoryAnalyticImplCopyWithImpl( + _$InventoryAnalyticImpl _value, + $Res Function(_$InventoryAnalyticImpl) _then, + ) : super(_value, _then); + + /// Create a copy of InventoryAnalytic + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? summary = null, + Object? products = null, + Object? ingredients = null, + }) { + return _then( + _$InventoryAnalyticImpl( + summary: null == summary + ? _value.summary + : summary // ignore: cast_nullable_to_non_nullable + as InventoryAnalyticSummary, + products: null == products + ? _value._products + : products // ignore: cast_nullable_to_non_nullable + as List, + ingredients: null == ingredients + ? _value._ingredients + : ingredients // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} + +/// @nodoc + +class _$InventoryAnalyticImpl implements _InventoryAnalytic { + const _$InventoryAnalyticImpl({ + required this.summary, + required final List products, + required final List ingredients, + }) : _products = products, + _ingredients = ingredients; + + @override + final InventoryAnalyticSummary summary; + final List _products; + @override + List get products { + if (_products is EqualUnmodifiableListView) return _products; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_products); + } + + final List _ingredients; + @override + List get ingredients { + if (_ingredients is EqualUnmodifiableListView) return _ingredients; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_ingredients); + } + + @override + String toString() { + return 'InventoryAnalytic(summary: $summary, products: $products, ingredients: $ingredients)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$InventoryAnalyticImpl && + (identical(other.summary, summary) || other.summary == summary) && + const DeepCollectionEquality().equals(other._products, _products) && + const DeepCollectionEquality().equals( + other._ingredients, + _ingredients, + )); + } + + @override + int get hashCode => Object.hash( + runtimeType, + summary, + const DeepCollectionEquality().hash(_products), + const DeepCollectionEquality().hash(_ingredients), + ); + + /// Create a copy of InventoryAnalytic + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$InventoryAnalyticImplCopyWith<_$InventoryAnalyticImpl> get copyWith => + __$$InventoryAnalyticImplCopyWithImpl<_$InventoryAnalyticImpl>( + this, + _$identity, + ); +} + +abstract class _InventoryAnalytic implements InventoryAnalytic { + const factory _InventoryAnalytic({ + required final InventoryAnalyticSummary summary, + required final List products, + required final List ingredients, + }) = _$InventoryAnalyticImpl; + + @override + InventoryAnalyticSummary get summary; + @override + List get products; + @override + List get ingredients; + + /// Create a copy of InventoryAnalytic + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$InventoryAnalyticImplCopyWith<_$InventoryAnalyticImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +mixin _$InventoryAnalyticSummary { + int get totalProducts => throw _privateConstructorUsedError; + int get totalIngredients => throw _privateConstructorUsedError; + int get totalValue => throw _privateConstructorUsedError; + int get lowStockProducts => throw _privateConstructorUsedError; + int get lowStockIngredients => throw _privateConstructorUsedError; + int get zeroStockProducts => throw _privateConstructorUsedError; + int get zeroStockIngredients => throw _privateConstructorUsedError; + int get totalSoldProducts => throw _privateConstructorUsedError; + int get totalSoldIngredients => throw _privateConstructorUsedError; + String get outletId => throw _privateConstructorUsedError; + String get outletName => throw _privateConstructorUsedError; + DateTime get generatedAt => throw _privateConstructorUsedError; + + /// Create a copy of InventoryAnalyticSummary + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $InventoryAnalyticSummaryCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $InventoryAnalyticSummaryCopyWith<$Res> { + factory $InventoryAnalyticSummaryCopyWith( + InventoryAnalyticSummary value, + $Res Function(InventoryAnalyticSummary) then, + ) = _$InventoryAnalyticSummaryCopyWithImpl<$Res, InventoryAnalyticSummary>; + @useResult + $Res call({ + int totalProducts, + int totalIngredients, + int totalValue, + int lowStockProducts, + int lowStockIngredients, + int zeroStockProducts, + int zeroStockIngredients, + int totalSoldProducts, + int totalSoldIngredients, + String outletId, + String outletName, + DateTime generatedAt, + }); +} + +/// @nodoc +class _$InventoryAnalyticSummaryCopyWithImpl< + $Res, + $Val extends InventoryAnalyticSummary +> + implements $InventoryAnalyticSummaryCopyWith<$Res> { + _$InventoryAnalyticSummaryCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of InventoryAnalyticSummary + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? totalProducts = null, + Object? totalIngredients = null, + Object? totalValue = null, + Object? lowStockProducts = null, + Object? lowStockIngredients = null, + Object? zeroStockProducts = null, + Object? zeroStockIngredients = null, + Object? totalSoldProducts = null, + Object? totalSoldIngredients = null, + Object? outletId = null, + Object? outletName = null, + Object? generatedAt = null, + }) { + return _then( + _value.copyWith( + totalProducts: null == totalProducts + ? _value.totalProducts + : totalProducts // ignore: cast_nullable_to_non_nullable + as int, + totalIngredients: null == totalIngredients + ? _value.totalIngredients + : totalIngredients // ignore: cast_nullable_to_non_nullable + as int, + totalValue: null == totalValue + ? _value.totalValue + : totalValue // ignore: cast_nullable_to_non_nullable + as int, + lowStockProducts: null == lowStockProducts + ? _value.lowStockProducts + : lowStockProducts // ignore: cast_nullable_to_non_nullable + as int, + lowStockIngredients: null == lowStockIngredients + ? _value.lowStockIngredients + : lowStockIngredients // ignore: cast_nullable_to_non_nullable + as int, + zeroStockProducts: null == zeroStockProducts + ? _value.zeroStockProducts + : zeroStockProducts // ignore: cast_nullable_to_non_nullable + as int, + zeroStockIngredients: null == zeroStockIngredients + ? _value.zeroStockIngredients + : zeroStockIngredients // ignore: cast_nullable_to_non_nullable + as int, + totalSoldProducts: null == totalSoldProducts + ? _value.totalSoldProducts + : totalSoldProducts // ignore: cast_nullable_to_non_nullable + as int, + totalSoldIngredients: null == totalSoldIngredients + ? _value.totalSoldIngredients + : totalSoldIngredients // ignore: cast_nullable_to_non_nullable + as int, + outletId: null == outletId + ? _value.outletId + : outletId // ignore: cast_nullable_to_non_nullable + as String, + outletName: null == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String, + generatedAt: null == generatedAt + ? _value.generatedAt + : generatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ) + as $Val, + ); + } +} + +/// @nodoc +abstract class _$$InventoryAnalyticSummaryImplCopyWith<$Res> + implements $InventoryAnalyticSummaryCopyWith<$Res> { + factory _$$InventoryAnalyticSummaryImplCopyWith( + _$InventoryAnalyticSummaryImpl value, + $Res Function(_$InventoryAnalyticSummaryImpl) then, + ) = __$$InventoryAnalyticSummaryImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({ + int totalProducts, + int totalIngredients, + int totalValue, + int lowStockProducts, + int lowStockIngredients, + int zeroStockProducts, + int zeroStockIngredients, + int totalSoldProducts, + int totalSoldIngredients, + String outletId, + String outletName, + DateTime generatedAt, + }); +} + +/// @nodoc +class __$$InventoryAnalyticSummaryImplCopyWithImpl<$Res> + extends + _$InventoryAnalyticSummaryCopyWithImpl< + $Res, + _$InventoryAnalyticSummaryImpl + > + implements _$$InventoryAnalyticSummaryImplCopyWith<$Res> { + __$$InventoryAnalyticSummaryImplCopyWithImpl( + _$InventoryAnalyticSummaryImpl _value, + $Res Function(_$InventoryAnalyticSummaryImpl) _then, + ) : super(_value, _then); + + /// Create a copy of InventoryAnalyticSummary + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? totalProducts = null, + Object? totalIngredients = null, + Object? totalValue = null, + Object? lowStockProducts = null, + Object? lowStockIngredients = null, + Object? zeroStockProducts = null, + Object? zeroStockIngredients = null, + Object? totalSoldProducts = null, + Object? totalSoldIngredients = null, + Object? outletId = null, + Object? outletName = null, + Object? generatedAt = null, + }) { + return _then( + _$InventoryAnalyticSummaryImpl( + totalProducts: null == totalProducts + ? _value.totalProducts + : totalProducts // ignore: cast_nullable_to_non_nullable + as int, + totalIngredients: null == totalIngredients + ? _value.totalIngredients + : totalIngredients // ignore: cast_nullable_to_non_nullable + as int, + totalValue: null == totalValue + ? _value.totalValue + : totalValue // ignore: cast_nullable_to_non_nullable + as int, + lowStockProducts: null == lowStockProducts + ? _value.lowStockProducts + : lowStockProducts // ignore: cast_nullable_to_non_nullable + as int, + lowStockIngredients: null == lowStockIngredients + ? _value.lowStockIngredients + : lowStockIngredients // ignore: cast_nullable_to_non_nullable + as int, + zeroStockProducts: null == zeroStockProducts + ? _value.zeroStockProducts + : zeroStockProducts // ignore: cast_nullable_to_non_nullable + as int, + zeroStockIngredients: null == zeroStockIngredients + ? _value.zeroStockIngredients + : zeroStockIngredients // ignore: cast_nullable_to_non_nullable + as int, + totalSoldProducts: null == totalSoldProducts + ? _value.totalSoldProducts + : totalSoldProducts // ignore: cast_nullable_to_non_nullable + as int, + totalSoldIngredients: null == totalSoldIngredients + ? _value.totalSoldIngredients + : totalSoldIngredients // ignore: cast_nullable_to_non_nullable + as int, + outletId: null == outletId + ? _value.outletId + : outletId // ignore: cast_nullable_to_non_nullable + as String, + outletName: null == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String, + generatedAt: null == generatedAt + ? _value.generatedAt + : generatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ), + ); + } +} + +/// @nodoc + +class _$InventoryAnalyticSummaryImpl implements _InventoryAnalyticSummary { + const _$InventoryAnalyticSummaryImpl({ + required this.totalProducts, + required this.totalIngredients, + required this.totalValue, + required this.lowStockProducts, + required this.lowStockIngredients, + required this.zeroStockProducts, + required this.zeroStockIngredients, + required this.totalSoldProducts, + required this.totalSoldIngredients, + required this.outletId, + required this.outletName, + required this.generatedAt, + }); + + @override + final int totalProducts; + @override + final int totalIngredients; + @override + final int totalValue; + @override + final int lowStockProducts; + @override + final int lowStockIngredients; + @override + final int zeroStockProducts; + @override + final int zeroStockIngredients; + @override + final int totalSoldProducts; + @override + final int totalSoldIngredients; + @override + final String outletId; + @override + final String outletName; + @override + final DateTime generatedAt; + + @override + String toString() { + return 'InventoryAnalyticSummary(totalProducts: $totalProducts, totalIngredients: $totalIngredients, totalValue: $totalValue, lowStockProducts: $lowStockProducts, lowStockIngredients: $lowStockIngredients, zeroStockProducts: $zeroStockProducts, zeroStockIngredients: $zeroStockIngredients, totalSoldProducts: $totalSoldProducts, totalSoldIngredients: $totalSoldIngredients, outletId: $outletId, outletName: $outletName, generatedAt: $generatedAt)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$InventoryAnalyticSummaryImpl && + (identical(other.totalProducts, totalProducts) || + other.totalProducts == totalProducts) && + (identical(other.totalIngredients, totalIngredients) || + other.totalIngredients == totalIngredients) && + (identical(other.totalValue, totalValue) || + other.totalValue == totalValue) && + (identical(other.lowStockProducts, lowStockProducts) || + other.lowStockProducts == lowStockProducts) && + (identical(other.lowStockIngredients, lowStockIngredients) || + other.lowStockIngredients == lowStockIngredients) && + (identical(other.zeroStockProducts, zeroStockProducts) || + other.zeroStockProducts == zeroStockProducts) && + (identical(other.zeroStockIngredients, zeroStockIngredients) || + other.zeroStockIngredients == zeroStockIngredients) && + (identical(other.totalSoldProducts, totalSoldProducts) || + other.totalSoldProducts == totalSoldProducts) && + (identical(other.totalSoldIngredients, totalSoldIngredients) || + other.totalSoldIngredients == totalSoldIngredients) && + (identical(other.outletId, outletId) || + other.outletId == outletId) && + (identical(other.outletName, outletName) || + other.outletName == outletName) && + (identical(other.generatedAt, generatedAt) || + other.generatedAt == generatedAt)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + totalProducts, + totalIngredients, + totalValue, + lowStockProducts, + lowStockIngredients, + zeroStockProducts, + zeroStockIngredients, + totalSoldProducts, + totalSoldIngredients, + outletId, + outletName, + generatedAt, + ); + + /// Create a copy of InventoryAnalyticSummary + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$InventoryAnalyticSummaryImplCopyWith<_$InventoryAnalyticSummaryImpl> + get copyWith => + __$$InventoryAnalyticSummaryImplCopyWithImpl< + _$InventoryAnalyticSummaryImpl + >(this, _$identity); +} + +abstract class _InventoryAnalyticSummary implements InventoryAnalyticSummary { + const factory _InventoryAnalyticSummary({ + required final int totalProducts, + required final int totalIngredients, + required final int totalValue, + required final int lowStockProducts, + required final int lowStockIngredients, + required final int zeroStockProducts, + required final int zeroStockIngredients, + required final int totalSoldProducts, + required final int totalSoldIngredients, + required final String outletId, + required final String outletName, + required final DateTime generatedAt, + }) = _$InventoryAnalyticSummaryImpl; + + @override + int get totalProducts; + @override + int get totalIngredients; + @override + int get totalValue; + @override + int get lowStockProducts; + @override + int get lowStockIngredients; + @override + int get zeroStockProducts; + @override + int get zeroStockIngredients; + @override + int get totalSoldProducts; + @override + int get totalSoldIngredients; + @override + String get outletId; + @override + String get outletName; + @override + DateTime get generatedAt; + + /// Create a copy of InventoryAnalyticSummary + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$InventoryAnalyticSummaryImplCopyWith<_$InventoryAnalyticSummaryImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +mixin _$InventoryAnalyticProductItem { + String get id => throw _privateConstructorUsedError; + String get productId => throw _privateConstructorUsedError; + String get productName => throw _privateConstructorUsedError; + String get categoryName => throw _privateConstructorUsedError; + int get quantity => throw _privateConstructorUsedError; + int get reorderLevel => throw _privateConstructorUsedError; + num get unitCost => throw _privateConstructorUsedError; + int get totalValue => throw _privateConstructorUsedError; + int get totalIn => throw _privateConstructorUsedError; + int get totalOut => throw _privateConstructorUsedError; + bool get isLowStock => throw _privateConstructorUsedError; + bool get isZeroStock => throw _privateConstructorUsedError; + DateTime get updatedAt => throw _privateConstructorUsedError; + + /// Create a copy of InventoryAnalyticProductItem + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $InventoryAnalyticProductItemCopyWith + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $InventoryAnalyticProductItemCopyWith<$Res> { + factory $InventoryAnalyticProductItemCopyWith( + InventoryAnalyticProductItem value, + $Res Function(InventoryAnalyticProductItem) then, + ) = + _$InventoryAnalyticProductItemCopyWithImpl< + $Res, + InventoryAnalyticProductItem + >; + @useResult + $Res call({ + String id, + String productId, + String productName, + String categoryName, + int quantity, + int reorderLevel, + num unitCost, + int totalValue, + int totalIn, + int totalOut, + bool isLowStock, + bool isZeroStock, + DateTime updatedAt, + }); +} + +/// @nodoc +class _$InventoryAnalyticProductItemCopyWithImpl< + $Res, + $Val extends InventoryAnalyticProductItem +> + implements $InventoryAnalyticProductItemCopyWith<$Res> { + _$InventoryAnalyticProductItemCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of InventoryAnalyticProductItem + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? productId = null, + Object? productName = null, + Object? categoryName = null, + Object? quantity = null, + Object? reorderLevel = null, + Object? unitCost = null, + Object? totalValue = null, + Object? totalIn = null, + Object? totalOut = null, + Object? isLowStock = null, + Object? isZeroStock = null, + Object? updatedAt = null, + }) { + return _then( + _value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + productId: null == productId + ? _value.productId + : productId // ignore: cast_nullable_to_non_nullable + as String, + productName: null == productName + ? _value.productName + : productName // ignore: cast_nullable_to_non_nullable + as String, + categoryName: null == categoryName + ? _value.categoryName + : categoryName // ignore: cast_nullable_to_non_nullable + as String, + quantity: null == quantity + ? _value.quantity + : quantity // ignore: cast_nullable_to_non_nullable + as int, + reorderLevel: null == reorderLevel + ? _value.reorderLevel + : reorderLevel // ignore: cast_nullable_to_non_nullable + as int, + unitCost: null == unitCost + ? _value.unitCost + : unitCost // ignore: cast_nullable_to_non_nullable + as num, + totalValue: null == totalValue + ? _value.totalValue + : totalValue // ignore: cast_nullable_to_non_nullable + as int, + totalIn: null == totalIn + ? _value.totalIn + : totalIn // ignore: cast_nullable_to_non_nullable + as int, + totalOut: null == totalOut + ? _value.totalOut + : totalOut // ignore: cast_nullable_to_non_nullable + as int, + isLowStock: null == isLowStock + ? _value.isLowStock + : isLowStock // ignore: cast_nullable_to_non_nullable + as bool, + isZeroStock: null == isZeroStock + ? _value.isZeroStock + : isZeroStock // ignore: cast_nullable_to_non_nullable + as bool, + updatedAt: null == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ) + as $Val, + ); + } +} + +/// @nodoc +abstract class _$$InventoryAnalyticProductItemImplCopyWith<$Res> + implements $InventoryAnalyticProductItemCopyWith<$Res> { + factory _$$InventoryAnalyticProductItemImplCopyWith( + _$InventoryAnalyticProductItemImpl value, + $Res Function(_$InventoryAnalyticProductItemImpl) then, + ) = __$$InventoryAnalyticProductItemImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({ + String id, + String productId, + String productName, + String categoryName, + int quantity, + int reorderLevel, + num unitCost, + int totalValue, + int totalIn, + int totalOut, + bool isLowStock, + bool isZeroStock, + DateTime updatedAt, + }); +} + +/// @nodoc +class __$$InventoryAnalyticProductItemImplCopyWithImpl<$Res> + extends + _$InventoryAnalyticProductItemCopyWithImpl< + $Res, + _$InventoryAnalyticProductItemImpl + > + implements _$$InventoryAnalyticProductItemImplCopyWith<$Res> { + __$$InventoryAnalyticProductItemImplCopyWithImpl( + _$InventoryAnalyticProductItemImpl _value, + $Res Function(_$InventoryAnalyticProductItemImpl) _then, + ) : super(_value, _then); + + /// Create a copy of InventoryAnalyticProductItem + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? productId = null, + Object? productName = null, + Object? categoryName = null, + Object? quantity = null, + Object? reorderLevel = null, + Object? unitCost = null, + Object? totalValue = null, + Object? totalIn = null, + Object? totalOut = null, + Object? isLowStock = null, + Object? isZeroStock = null, + Object? updatedAt = null, + }) { + return _then( + _$InventoryAnalyticProductItemImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + productId: null == productId + ? _value.productId + : productId // ignore: cast_nullable_to_non_nullable + as String, + productName: null == productName + ? _value.productName + : productName // ignore: cast_nullable_to_non_nullable + as String, + categoryName: null == categoryName + ? _value.categoryName + : categoryName // ignore: cast_nullable_to_non_nullable + as String, + quantity: null == quantity + ? _value.quantity + : quantity // ignore: cast_nullable_to_non_nullable + as int, + reorderLevel: null == reorderLevel + ? _value.reorderLevel + : reorderLevel // ignore: cast_nullable_to_non_nullable + as int, + unitCost: null == unitCost + ? _value.unitCost + : unitCost // ignore: cast_nullable_to_non_nullable + as num, + totalValue: null == totalValue + ? _value.totalValue + : totalValue // ignore: cast_nullable_to_non_nullable + as int, + totalIn: null == totalIn + ? _value.totalIn + : totalIn // ignore: cast_nullable_to_non_nullable + as int, + totalOut: null == totalOut + ? _value.totalOut + : totalOut // ignore: cast_nullable_to_non_nullable + as int, + isLowStock: null == isLowStock + ? _value.isLowStock + : isLowStock // ignore: cast_nullable_to_non_nullable + as bool, + isZeroStock: null == isZeroStock + ? _value.isZeroStock + : isZeroStock // ignore: cast_nullable_to_non_nullable + as bool, + updatedAt: null == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ), + ); + } +} + +/// @nodoc + +class _$InventoryAnalyticProductItemImpl + implements _InventoryAnalyticProductItem { + const _$InventoryAnalyticProductItemImpl({ + required this.id, + required this.productId, + required this.productName, + required this.categoryName, + required this.quantity, + required this.reorderLevel, + required this.unitCost, + required this.totalValue, + required this.totalIn, + required this.totalOut, + required this.isLowStock, + required this.isZeroStock, + required this.updatedAt, + }); + + @override + final String id; + @override + final String productId; + @override + final String productName; + @override + final String categoryName; + @override + final int quantity; + @override + final int reorderLevel; + @override + final num unitCost; + @override + final int totalValue; + @override + final int totalIn; + @override + final int totalOut; + @override + final bool isLowStock; + @override + final bool isZeroStock; + @override + final DateTime updatedAt; + + @override + String toString() { + return 'InventoryAnalyticProductItem(id: $id, productId: $productId, productName: $productName, categoryName: $categoryName, quantity: $quantity, reorderLevel: $reorderLevel, unitCost: $unitCost, totalValue: $totalValue, totalIn: $totalIn, totalOut: $totalOut, isLowStock: $isLowStock, isZeroStock: $isZeroStock, updatedAt: $updatedAt)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$InventoryAnalyticProductItemImpl && + (identical(other.id, id) || other.id == id) && + (identical(other.productId, productId) || + other.productId == productId) && + (identical(other.productName, productName) || + other.productName == productName) && + (identical(other.categoryName, categoryName) || + other.categoryName == categoryName) && + (identical(other.quantity, quantity) || + other.quantity == quantity) && + (identical(other.reorderLevel, reorderLevel) || + other.reorderLevel == reorderLevel) && + (identical(other.unitCost, unitCost) || + other.unitCost == unitCost) && + (identical(other.totalValue, totalValue) || + other.totalValue == totalValue) && + (identical(other.totalIn, totalIn) || other.totalIn == totalIn) && + (identical(other.totalOut, totalOut) || + other.totalOut == totalOut) && + (identical(other.isLowStock, isLowStock) || + other.isLowStock == isLowStock) && + (identical(other.isZeroStock, isZeroStock) || + other.isZeroStock == isZeroStock) && + (identical(other.updatedAt, updatedAt) || + other.updatedAt == updatedAt)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + id, + productId, + productName, + categoryName, + quantity, + reorderLevel, + unitCost, + totalValue, + totalIn, + totalOut, + isLowStock, + isZeroStock, + updatedAt, + ); + + /// Create a copy of InventoryAnalyticProductItem + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$InventoryAnalyticProductItemImplCopyWith< + _$InventoryAnalyticProductItemImpl + > + get copyWith => + __$$InventoryAnalyticProductItemImplCopyWithImpl< + _$InventoryAnalyticProductItemImpl + >(this, _$identity); +} + +abstract class _InventoryAnalyticProductItem + implements InventoryAnalyticProductItem { + const factory _InventoryAnalyticProductItem({ + required final String id, + required final String productId, + required final String productName, + required final String categoryName, + required final int quantity, + required final int reorderLevel, + required final num unitCost, + required final int totalValue, + required final int totalIn, + required final int totalOut, + required final bool isLowStock, + required final bool isZeroStock, + required final DateTime updatedAt, + }) = _$InventoryAnalyticProductItemImpl; + + @override + String get id; + @override + String get productId; + @override + String get productName; + @override + String get categoryName; + @override + int get quantity; + @override + int get reorderLevel; + @override + num get unitCost; + @override + int get totalValue; + @override + int get totalIn; + @override + int get totalOut; + @override + bool get isLowStock; + @override + bool get isZeroStock; + @override + DateTime get updatedAt; + + /// Create a copy of InventoryAnalyticProductItem + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$InventoryAnalyticProductItemImplCopyWith< + _$InventoryAnalyticProductItemImpl + > + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +mixin _$InventoryAnalyticIngredientItem { + String get id => throw _privateConstructorUsedError; + String get ingredientId => throw _privateConstructorUsedError; + String get ingredientName => throw _privateConstructorUsedError; + String get unitName => throw _privateConstructorUsedError; + int get quantity => throw _privateConstructorUsedError; + int get reorderLevel => throw _privateConstructorUsedError; + num get unitCost => throw _privateConstructorUsedError; + int get totalValue => throw _privateConstructorUsedError; + int get totalIn => throw _privateConstructorUsedError; + int get totalOut => throw _privateConstructorUsedError; + bool get isLowStock => throw _privateConstructorUsedError; + bool get isZeroStock => throw _privateConstructorUsedError; + DateTime get updatedAt => throw _privateConstructorUsedError; + + /// Create a copy of InventoryAnalyticIngredientItem + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $InventoryAnalyticIngredientItemCopyWith + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $InventoryAnalyticIngredientItemCopyWith<$Res> { + factory $InventoryAnalyticIngredientItemCopyWith( + InventoryAnalyticIngredientItem value, + $Res Function(InventoryAnalyticIngredientItem) then, + ) = + _$InventoryAnalyticIngredientItemCopyWithImpl< + $Res, + InventoryAnalyticIngredientItem + >; + @useResult + $Res call({ + String id, + String ingredientId, + String ingredientName, + String unitName, + int quantity, + int reorderLevel, + num unitCost, + int totalValue, + int totalIn, + int totalOut, + bool isLowStock, + bool isZeroStock, + DateTime updatedAt, + }); +} + +/// @nodoc +class _$InventoryAnalyticIngredientItemCopyWithImpl< + $Res, + $Val extends InventoryAnalyticIngredientItem +> + implements $InventoryAnalyticIngredientItemCopyWith<$Res> { + _$InventoryAnalyticIngredientItemCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of InventoryAnalyticIngredientItem + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? ingredientId = null, + Object? ingredientName = null, + Object? unitName = null, + Object? quantity = null, + Object? reorderLevel = null, + Object? unitCost = null, + Object? totalValue = null, + Object? totalIn = null, + Object? totalOut = null, + Object? isLowStock = null, + Object? isZeroStock = null, + Object? updatedAt = null, + }) { + return _then( + _value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + ingredientId: null == ingredientId + ? _value.ingredientId + : ingredientId // ignore: cast_nullable_to_non_nullable + as String, + ingredientName: null == ingredientName + ? _value.ingredientName + : ingredientName // ignore: cast_nullable_to_non_nullable + as String, + unitName: null == unitName + ? _value.unitName + : unitName // ignore: cast_nullable_to_non_nullable + as String, + quantity: null == quantity + ? _value.quantity + : quantity // ignore: cast_nullable_to_non_nullable + as int, + reorderLevel: null == reorderLevel + ? _value.reorderLevel + : reorderLevel // ignore: cast_nullable_to_non_nullable + as int, + unitCost: null == unitCost + ? _value.unitCost + : unitCost // ignore: cast_nullable_to_non_nullable + as num, + totalValue: null == totalValue + ? _value.totalValue + : totalValue // ignore: cast_nullable_to_non_nullable + as int, + totalIn: null == totalIn + ? _value.totalIn + : totalIn // ignore: cast_nullable_to_non_nullable + as int, + totalOut: null == totalOut + ? _value.totalOut + : totalOut // ignore: cast_nullable_to_non_nullable + as int, + isLowStock: null == isLowStock + ? _value.isLowStock + : isLowStock // ignore: cast_nullable_to_non_nullable + as bool, + isZeroStock: null == isZeroStock + ? _value.isZeroStock + : isZeroStock // ignore: cast_nullable_to_non_nullable + as bool, + updatedAt: null == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ) + as $Val, + ); + } +} + +/// @nodoc +abstract class _$$InventoryAnalyticIngredientItemImplCopyWith<$Res> + implements $InventoryAnalyticIngredientItemCopyWith<$Res> { + factory _$$InventoryAnalyticIngredientItemImplCopyWith( + _$InventoryAnalyticIngredientItemImpl value, + $Res Function(_$InventoryAnalyticIngredientItemImpl) then, + ) = __$$InventoryAnalyticIngredientItemImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({ + String id, + String ingredientId, + String ingredientName, + String unitName, + int quantity, + int reorderLevel, + num unitCost, + int totalValue, + int totalIn, + int totalOut, + bool isLowStock, + bool isZeroStock, + DateTime updatedAt, + }); +} + +/// @nodoc +class __$$InventoryAnalyticIngredientItemImplCopyWithImpl<$Res> + extends + _$InventoryAnalyticIngredientItemCopyWithImpl< + $Res, + _$InventoryAnalyticIngredientItemImpl + > + implements _$$InventoryAnalyticIngredientItemImplCopyWith<$Res> { + __$$InventoryAnalyticIngredientItemImplCopyWithImpl( + _$InventoryAnalyticIngredientItemImpl _value, + $Res Function(_$InventoryAnalyticIngredientItemImpl) _then, + ) : super(_value, _then); + + /// Create a copy of InventoryAnalyticIngredientItem + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? ingredientId = null, + Object? ingredientName = null, + Object? unitName = null, + Object? quantity = null, + Object? reorderLevel = null, + Object? unitCost = null, + Object? totalValue = null, + Object? totalIn = null, + Object? totalOut = null, + Object? isLowStock = null, + Object? isZeroStock = null, + Object? updatedAt = null, + }) { + return _then( + _$InventoryAnalyticIngredientItemImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + ingredientId: null == ingredientId + ? _value.ingredientId + : ingredientId // ignore: cast_nullable_to_non_nullable + as String, + ingredientName: null == ingredientName + ? _value.ingredientName + : ingredientName // ignore: cast_nullable_to_non_nullable + as String, + unitName: null == unitName + ? _value.unitName + : unitName // ignore: cast_nullable_to_non_nullable + as String, + quantity: null == quantity + ? _value.quantity + : quantity // ignore: cast_nullable_to_non_nullable + as int, + reorderLevel: null == reorderLevel + ? _value.reorderLevel + : reorderLevel // ignore: cast_nullable_to_non_nullable + as int, + unitCost: null == unitCost + ? _value.unitCost + : unitCost // ignore: cast_nullable_to_non_nullable + as num, + totalValue: null == totalValue + ? _value.totalValue + : totalValue // ignore: cast_nullable_to_non_nullable + as int, + totalIn: null == totalIn + ? _value.totalIn + : totalIn // ignore: cast_nullable_to_non_nullable + as int, + totalOut: null == totalOut + ? _value.totalOut + : totalOut // ignore: cast_nullable_to_non_nullable + as int, + isLowStock: null == isLowStock + ? _value.isLowStock + : isLowStock // ignore: cast_nullable_to_non_nullable + as bool, + isZeroStock: null == isZeroStock + ? _value.isZeroStock + : isZeroStock // ignore: cast_nullable_to_non_nullable + as bool, + updatedAt: null == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ), + ); + } +} + +/// @nodoc + +class _$InventoryAnalyticIngredientItemImpl + implements _InventoryAnalyticIngredientItem { + const _$InventoryAnalyticIngredientItemImpl({ + required this.id, + required this.ingredientId, + required this.ingredientName, + required this.unitName, + required this.quantity, + required this.reorderLevel, + required this.unitCost, + required this.totalValue, + required this.totalIn, + required this.totalOut, + required this.isLowStock, + required this.isZeroStock, + required this.updatedAt, + }); + + @override + final String id; + @override + final String ingredientId; + @override + final String ingredientName; + @override + final String unitName; + @override + final int quantity; + @override + final int reorderLevel; + @override + final num unitCost; + @override + final int totalValue; + @override + final int totalIn; + @override + final int totalOut; + @override + final bool isLowStock; + @override + final bool isZeroStock; + @override + final DateTime updatedAt; + + @override + String toString() { + return 'InventoryAnalyticIngredientItem(id: $id, ingredientId: $ingredientId, ingredientName: $ingredientName, unitName: $unitName, quantity: $quantity, reorderLevel: $reorderLevel, unitCost: $unitCost, totalValue: $totalValue, totalIn: $totalIn, totalOut: $totalOut, isLowStock: $isLowStock, isZeroStock: $isZeroStock, updatedAt: $updatedAt)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$InventoryAnalyticIngredientItemImpl && + (identical(other.id, id) || other.id == id) && + (identical(other.ingredientId, ingredientId) || + other.ingredientId == ingredientId) && + (identical(other.ingredientName, ingredientName) || + other.ingredientName == ingredientName) && + (identical(other.unitName, unitName) || + other.unitName == unitName) && + (identical(other.quantity, quantity) || + other.quantity == quantity) && + (identical(other.reorderLevel, reorderLevel) || + other.reorderLevel == reorderLevel) && + (identical(other.unitCost, unitCost) || + other.unitCost == unitCost) && + (identical(other.totalValue, totalValue) || + other.totalValue == totalValue) && + (identical(other.totalIn, totalIn) || other.totalIn == totalIn) && + (identical(other.totalOut, totalOut) || + other.totalOut == totalOut) && + (identical(other.isLowStock, isLowStock) || + other.isLowStock == isLowStock) && + (identical(other.isZeroStock, isZeroStock) || + other.isZeroStock == isZeroStock) && + (identical(other.updatedAt, updatedAt) || + other.updatedAt == updatedAt)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + id, + ingredientId, + ingredientName, + unitName, + quantity, + reorderLevel, + unitCost, + totalValue, + totalIn, + totalOut, + isLowStock, + isZeroStock, + updatedAt, + ); + + /// Create a copy of InventoryAnalyticIngredientItem + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$InventoryAnalyticIngredientItemImplCopyWith< + _$InventoryAnalyticIngredientItemImpl + > + get copyWith => + __$$InventoryAnalyticIngredientItemImplCopyWithImpl< + _$InventoryAnalyticIngredientItemImpl + >(this, _$identity); +} + +abstract class _InventoryAnalyticIngredientItem + implements InventoryAnalyticIngredientItem { + const factory _InventoryAnalyticIngredientItem({ + required final String id, + required final String ingredientId, + required final String ingredientName, + required final String unitName, + required final int quantity, + required final int reorderLevel, + required final num unitCost, + required final int totalValue, + required final int totalIn, + required final int totalOut, + required final bool isLowStock, + required final bool isZeroStock, + required final DateTime updatedAt, + }) = _$InventoryAnalyticIngredientItemImpl; + + @override + String get id; + @override + String get ingredientId; + @override + String get ingredientName; + @override + String get unitName; + @override + int get quantity; + @override + int get reorderLevel; + @override + num get unitCost; + @override + int get totalValue; + @override + int get totalIn; + @override + int get totalOut; + @override + bool get isLowStock; + @override + bool get isZeroStock; + @override + DateTime get updatedAt; + + /// Create a copy of InventoryAnalyticIngredientItem + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$InventoryAnalyticIngredientItemImplCopyWith< + _$InventoryAnalyticIngredientItemImpl + > + get copyWith => throw _privateConstructorUsedError; +} + /// @nodoc mixin _$AnalyticFailure { @optionalTypeArgs diff --git a/lib/domain/analytic/entities/inventory_analytic_entity.dart b/lib/domain/analytic/entities/inventory_analytic_entity.dart new file mode 100644 index 0000000..64db93e --- /dev/null +++ b/lib/domain/analytic/entities/inventory_analytic_entity.dart @@ -0,0 +1,120 @@ +part of '../analytic.dart'; + +@freezed +class InventoryAnalytic with _$InventoryAnalytic { + const factory InventoryAnalytic({ + required InventoryAnalyticSummary summary, + required List products, + required List ingredients, + }) = _InventoryAnalytic; + + factory InventoryAnalytic.empty() => InventoryAnalytic( + summary: InventoryAnalyticSummary.empty(), + products: const [], + ingredients: const [], + ); +} + +@freezed +class InventoryAnalyticSummary with _$InventoryAnalyticSummary { + const factory InventoryAnalyticSummary({ + required int totalProducts, + required int totalIngredients, + required int totalValue, + required int lowStockProducts, + required int lowStockIngredients, + required int zeroStockProducts, + required int zeroStockIngredients, + required int totalSoldProducts, + required int totalSoldIngredients, + required String outletId, + required String outletName, + required DateTime generatedAt, + }) = _InventoryAnalyticSummary; + + factory InventoryAnalyticSummary.empty() => InventoryAnalyticSummary( + totalProducts: 0, + totalIngredients: 0, + totalValue: 0, + lowStockProducts: 0, + lowStockIngredients: 0, + zeroStockProducts: 0, + zeroStockIngredients: 0, + totalSoldProducts: 0, + totalSoldIngredients: 0, + outletId: '', + outletName: '', + generatedAt: DateTime.now(), + ); +} + +@freezed +class InventoryAnalyticProductItem with _$InventoryAnalyticProductItem { + const factory InventoryAnalyticProductItem({ + required String id, + required String productId, + required String productName, + required String categoryName, + required int quantity, + required int reorderLevel, + required num unitCost, + required int totalValue, + required int totalIn, + required int totalOut, + required bool isLowStock, + required bool isZeroStock, + required DateTime updatedAt, + }) = _InventoryAnalyticProductItem; + + factory InventoryAnalyticProductItem.empty() => InventoryAnalyticProductItem( + id: '', + productId: '', + productName: '', + categoryName: '', + quantity: 0, + reorderLevel: 0, + unitCost: 0, + totalValue: 0, + totalIn: 0, + totalOut: 0, + isLowStock: false, + isZeroStock: false, + updatedAt: DateTime.now(), + ); +} + +@freezed +class InventoryAnalyticIngredientItem with _$InventoryAnalyticIngredientItem { + const factory InventoryAnalyticIngredientItem({ + required String id, + required String ingredientId, + required String ingredientName, + required String unitName, + required int quantity, + required int reorderLevel, + required num unitCost, + required int totalValue, + required int totalIn, + required int totalOut, + required bool isLowStock, + required bool isZeroStock, + required DateTime updatedAt, + }) = _InventoryAnalyticIngredientItem; + + factory InventoryAnalyticIngredientItem.empty() => + InventoryAnalyticIngredientItem( + id: '', + ingredientId: '', + ingredientName: '', + unitName: '', + quantity: 0, + reorderLevel: 0, + unitCost: 0, + totalValue: 0, + totalIn: 0, + totalOut: 0, + isLowStock: false, + isZeroStock: false, + updatedAt: DateTime.now(), + ); +} diff --git a/lib/domain/analytic/repositories/i_analytic_repository.dart b/lib/domain/analytic/repositories/i_analytic_repository.dart index 7fe14c1..b9da356 100644 --- a/lib/domain/analytic/repositories/i_analytic_repository.dart +++ b/lib/domain/analytic/repositories/i_analytic_repository.dart @@ -25,4 +25,8 @@ abstract class IAnalyticRepository { required DateTime dateFrom, required DateTime dateTo, }); + Future> getInventory({ + required DateTime dateFrom, + required DateTime dateTo, + }); } diff --git a/lib/infrastructure/analytic/analytic_dtos.dart b/lib/infrastructure/analytic/analytic_dtos.dart index 8f3fe63..694014f 100644 --- a/lib/infrastructure/analytic/analytic_dtos.dart +++ b/lib/infrastructure/analytic/analytic_dtos.dart @@ -11,3 +11,4 @@ part 'dtos/product_analytic_dto.dart'; part 'dtos/payment_method_analytic_dto.dart'; part 'dtos/profit_loss_analytic_dto.dart'; part 'dtos/category_analytic_dto.dart'; +part 'dtos/inventory_analytic_dto.dart'; diff --git a/lib/infrastructure/analytic/analytic_dtos.freezed.dart b/lib/infrastructure/analytic/analytic_dtos.freezed.dart index c3f90ea..1d1106e 100644 --- a/lib/infrastructure/analytic/analytic_dtos.freezed.dart +++ b/lib/infrastructure/analytic/analytic_dtos.freezed.dart @@ -6617,3 +6617,1727 @@ abstract class _CategoryAnalyticItemDto extends CategoryAnalyticItemDto { _$$CategoryAnalyticItemDtoImplCopyWith<_$CategoryAnalyticItemDtoImpl> get copyWith => throw _privateConstructorUsedError; } + +InventoryAnalyticDto _$InventoryAnalyticDtoFromJson(Map json) { + return _InventoryAnalyticDto.fromJson(json); +} + +/// @nodoc +mixin _$InventoryAnalyticDto { + @JsonKey(name: "summary") + InventoryAnalyticSummaryDto? get summary => + throw _privateConstructorUsedError; + @JsonKey(name: "products") + List? get products => + throw _privateConstructorUsedError; + @JsonKey(name: "ingredients") + List? get ingredients => + throw _privateConstructorUsedError; + + /// Serializes this InventoryAnalyticDto to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of InventoryAnalyticDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $InventoryAnalyticDtoCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $InventoryAnalyticDtoCopyWith<$Res> { + factory $InventoryAnalyticDtoCopyWith( + InventoryAnalyticDto value, + $Res Function(InventoryAnalyticDto) then, + ) = _$InventoryAnalyticDtoCopyWithImpl<$Res, InventoryAnalyticDto>; + @useResult + $Res call({ + @JsonKey(name: "summary") InventoryAnalyticSummaryDto? summary, + @JsonKey(name: "products") List? products, + @JsonKey(name: "ingredients") + List? ingredients, + }); + + $InventoryAnalyticSummaryDtoCopyWith<$Res>? get summary; +} + +/// @nodoc +class _$InventoryAnalyticDtoCopyWithImpl< + $Res, + $Val extends InventoryAnalyticDto +> + implements $InventoryAnalyticDtoCopyWith<$Res> { + _$InventoryAnalyticDtoCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of InventoryAnalyticDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? summary = freezed, + Object? products = freezed, + Object? ingredients = freezed, + }) { + return _then( + _value.copyWith( + summary: freezed == summary + ? _value.summary + : summary // ignore: cast_nullable_to_non_nullable + as InventoryAnalyticSummaryDto?, + products: freezed == products + ? _value.products + : products // ignore: cast_nullable_to_non_nullable + as List?, + ingredients: freezed == ingredients + ? _value.ingredients + : ingredients // ignore: cast_nullable_to_non_nullable + as List?, + ) + as $Val, + ); + } + + /// Create a copy of InventoryAnalyticDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $InventoryAnalyticSummaryDtoCopyWith<$Res>? get summary { + if (_value.summary == null) { + return null; + } + + return $InventoryAnalyticSummaryDtoCopyWith<$Res>(_value.summary!, (value) { + return _then(_value.copyWith(summary: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$InventoryAnalyticDtoImplCopyWith<$Res> + implements $InventoryAnalyticDtoCopyWith<$Res> { + factory _$$InventoryAnalyticDtoImplCopyWith( + _$InventoryAnalyticDtoImpl value, + $Res Function(_$InventoryAnalyticDtoImpl) then, + ) = __$$InventoryAnalyticDtoImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({ + @JsonKey(name: "summary") InventoryAnalyticSummaryDto? summary, + @JsonKey(name: "products") List? products, + @JsonKey(name: "ingredients") + List? ingredients, + }); + + @override + $InventoryAnalyticSummaryDtoCopyWith<$Res>? get summary; +} + +/// @nodoc +class __$$InventoryAnalyticDtoImplCopyWithImpl<$Res> + extends _$InventoryAnalyticDtoCopyWithImpl<$Res, _$InventoryAnalyticDtoImpl> + implements _$$InventoryAnalyticDtoImplCopyWith<$Res> { + __$$InventoryAnalyticDtoImplCopyWithImpl( + _$InventoryAnalyticDtoImpl _value, + $Res Function(_$InventoryAnalyticDtoImpl) _then, + ) : super(_value, _then); + + /// Create a copy of InventoryAnalyticDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? summary = freezed, + Object? products = freezed, + Object? ingredients = freezed, + }) { + return _then( + _$InventoryAnalyticDtoImpl( + summary: freezed == summary + ? _value.summary + : summary // ignore: cast_nullable_to_non_nullable + as InventoryAnalyticSummaryDto?, + products: freezed == products + ? _value._products + : products // ignore: cast_nullable_to_non_nullable + as List?, + ingredients: freezed == ingredients + ? _value._ingredients + : ingredients // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} + +/// @nodoc +@JsonSerializable() +class _$InventoryAnalyticDtoImpl extends _InventoryAnalyticDto { + const _$InventoryAnalyticDtoImpl({ + @JsonKey(name: "summary") this.summary, + @JsonKey(name: "products") + final List? products, + @JsonKey(name: "ingredients") + final List? ingredients, + }) : _products = products, + _ingredients = ingredients, + super._(); + + factory _$InventoryAnalyticDtoImpl.fromJson(Map json) => + _$$InventoryAnalyticDtoImplFromJson(json); + + @override + @JsonKey(name: "summary") + final InventoryAnalyticSummaryDto? summary; + final List? _products; + @override + @JsonKey(name: "products") + List? get products { + final value = _products; + if (value == null) return null; + if (_products is EqualUnmodifiableListView) return _products; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + final List? _ingredients; + @override + @JsonKey(name: "ingredients") + List? get ingredients { + final value = _ingredients; + if (value == null) return null; + if (_ingredients is EqualUnmodifiableListView) return _ingredients; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + @override + String toString() { + return 'InventoryAnalyticDto(summary: $summary, products: $products, ingredients: $ingredients)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$InventoryAnalyticDtoImpl && + (identical(other.summary, summary) || other.summary == summary) && + const DeepCollectionEquality().equals(other._products, _products) && + const DeepCollectionEquality().equals( + other._ingredients, + _ingredients, + )); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + summary, + const DeepCollectionEquality().hash(_products), + const DeepCollectionEquality().hash(_ingredients), + ); + + /// Create a copy of InventoryAnalyticDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$InventoryAnalyticDtoImplCopyWith<_$InventoryAnalyticDtoImpl> + get copyWith => + __$$InventoryAnalyticDtoImplCopyWithImpl<_$InventoryAnalyticDtoImpl>( + this, + _$identity, + ); + + @override + Map toJson() { + return _$$InventoryAnalyticDtoImplToJson(this); + } +} + +abstract class _InventoryAnalyticDto extends InventoryAnalyticDto { + const factory _InventoryAnalyticDto({ + @JsonKey(name: "summary") final InventoryAnalyticSummaryDto? summary, + @JsonKey(name: "products") + final List? products, + @JsonKey(name: "ingredients") + final List? ingredients, + }) = _$InventoryAnalyticDtoImpl; + const _InventoryAnalyticDto._() : super._(); + + factory _InventoryAnalyticDto.fromJson(Map json) = + _$InventoryAnalyticDtoImpl.fromJson; + + @override + @JsonKey(name: "summary") + InventoryAnalyticSummaryDto? get summary; + @override + @JsonKey(name: "products") + List? get products; + @override + @JsonKey(name: "ingredients") + List? get ingredients; + + /// Create a copy of InventoryAnalyticDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$InventoryAnalyticDtoImplCopyWith<_$InventoryAnalyticDtoImpl> + get copyWith => throw _privateConstructorUsedError; +} + +InventoryAnalyticSummaryDto _$InventoryAnalyticSummaryDtoFromJson( + Map json, +) { + return _InventoryAnalyticSummaryDto.fromJson(json); +} + +/// @nodoc +mixin _$InventoryAnalyticSummaryDto { + @JsonKey(name: "total_products") + int? get totalProducts => throw _privateConstructorUsedError; + @JsonKey(name: "total_ingredients") + int? get totalIngredients => throw _privateConstructorUsedError; + @JsonKey(name: "total_value") + int? get totalValue => throw _privateConstructorUsedError; + @JsonKey(name: "low_stock_products") + int? get lowStockProducts => throw _privateConstructorUsedError; + @JsonKey(name: "low_stock_ingredients") + int? get lowStockIngredients => throw _privateConstructorUsedError; + @JsonKey(name: "zero_stock_products") + int? get zeroStockProducts => throw _privateConstructorUsedError; + @JsonKey(name: "zero_stock_ingredients") + int? get zeroStockIngredients => throw _privateConstructorUsedError; + @JsonKey(name: "total_sold_products") + int? get totalSoldProducts => throw _privateConstructorUsedError; + @JsonKey(name: "total_sold_ingredients") + int? get totalSoldIngredients => throw _privateConstructorUsedError; + @JsonKey(name: "outlet_id") + String? get outletId => throw _privateConstructorUsedError; + @JsonKey(name: "outlet_name") + String? get outletName => throw _privateConstructorUsedError; + @JsonKey(name: "generated_at") + DateTime? get generatedAt => throw _privateConstructorUsedError; + + /// Serializes this InventoryAnalyticSummaryDto to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of InventoryAnalyticSummaryDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $InventoryAnalyticSummaryDtoCopyWith + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $InventoryAnalyticSummaryDtoCopyWith<$Res> { + factory $InventoryAnalyticSummaryDtoCopyWith( + InventoryAnalyticSummaryDto value, + $Res Function(InventoryAnalyticSummaryDto) then, + ) = + _$InventoryAnalyticSummaryDtoCopyWithImpl< + $Res, + InventoryAnalyticSummaryDto + >; + @useResult + $Res call({ + @JsonKey(name: "total_products") int? totalProducts, + @JsonKey(name: "total_ingredients") int? totalIngredients, + @JsonKey(name: "total_value") int? totalValue, + @JsonKey(name: "low_stock_products") int? lowStockProducts, + @JsonKey(name: "low_stock_ingredients") int? lowStockIngredients, + @JsonKey(name: "zero_stock_products") int? zeroStockProducts, + @JsonKey(name: "zero_stock_ingredients") int? zeroStockIngredients, + @JsonKey(name: "total_sold_products") int? totalSoldProducts, + @JsonKey(name: "total_sold_ingredients") int? totalSoldIngredients, + @JsonKey(name: "outlet_id") String? outletId, + @JsonKey(name: "outlet_name") String? outletName, + @JsonKey(name: "generated_at") DateTime? generatedAt, + }); +} + +/// @nodoc +class _$InventoryAnalyticSummaryDtoCopyWithImpl< + $Res, + $Val extends InventoryAnalyticSummaryDto +> + implements $InventoryAnalyticSummaryDtoCopyWith<$Res> { + _$InventoryAnalyticSummaryDtoCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of InventoryAnalyticSummaryDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? totalProducts = freezed, + Object? totalIngredients = freezed, + Object? totalValue = freezed, + Object? lowStockProducts = freezed, + Object? lowStockIngredients = freezed, + Object? zeroStockProducts = freezed, + Object? zeroStockIngredients = freezed, + Object? totalSoldProducts = freezed, + Object? totalSoldIngredients = freezed, + Object? outletId = freezed, + Object? outletName = freezed, + Object? generatedAt = freezed, + }) { + return _then( + _value.copyWith( + totalProducts: freezed == totalProducts + ? _value.totalProducts + : totalProducts // ignore: cast_nullable_to_non_nullable + as int?, + totalIngredients: freezed == totalIngredients + ? _value.totalIngredients + : totalIngredients // ignore: cast_nullable_to_non_nullable + as int?, + totalValue: freezed == totalValue + ? _value.totalValue + : totalValue // ignore: cast_nullable_to_non_nullable + as int?, + lowStockProducts: freezed == lowStockProducts + ? _value.lowStockProducts + : lowStockProducts // ignore: cast_nullable_to_non_nullable + as int?, + lowStockIngredients: freezed == lowStockIngredients + ? _value.lowStockIngredients + : lowStockIngredients // ignore: cast_nullable_to_non_nullable + as int?, + zeroStockProducts: freezed == zeroStockProducts + ? _value.zeroStockProducts + : zeroStockProducts // ignore: cast_nullable_to_non_nullable + as int?, + zeroStockIngredients: freezed == zeroStockIngredients + ? _value.zeroStockIngredients + : zeroStockIngredients // ignore: cast_nullable_to_non_nullable + as int?, + totalSoldProducts: freezed == totalSoldProducts + ? _value.totalSoldProducts + : totalSoldProducts // ignore: cast_nullable_to_non_nullable + as int?, + totalSoldIngredients: freezed == totalSoldIngredients + ? _value.totalSoldIngredients + : totalSoldIngredients // ignore: cast_nullable_to_non_nullable + as int?, + outletId: freezed == outletId + ? _value.outletId + : outletId // ignore: cast_nullable_to_non_nullable + as String?, + outletName: freezed == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String?, + generatedAt: freezed == generatedAt + ? _value.generatedAt + : generatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + ) + as $Val, + ); + } +} + +/// @nodoc +abstract class _$$InventoryAnalyticSummaryDtoImplCopyWith<$Res> + implements $InventoryAnalyticSummaryDtoCopyWith<$Res> { + factory _$$InventoryAnalyticSummaryDtoImplCopyWith( + _$InventoryAnalyticSummaryDtoImpl value, + $Res Function(_$InventoryAnalyticSummaryDtoImpl) then, + ) = __$$InventoryAnalyticSummaryDtoImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({ + @JsonKey(name: "total_products") int? totalProducts, + @JsonKey(name: "total_ingredients") int? totalIngredients, + @JsonKey(name: "total_value") int? totalValue, + @JsonKey(name: "low_stock_products") int? lowStockProducts, + @JsonKey(name: "low_stock_ingredients") int? lowStockIngredients, + @JsonKey(name: "zero_stock_products") int? zeroStockProducts, + @JsonKey(name: "zero_stock_ingredients") int? zeroStockIngredients, + @JsonKey(name: "total_sold_products") int? totalSoldProducts, + @JsonKey(name: "total_sold_ingredients") int? totalSoldIngredients, + @JsonKey(name: "outlet_id") String? outletId, + @JsonKey(name: "outlet_name") String? outletName, + @JsonKey(name: "generated_at") DateTime? generatedAt, + }); +} + +/// @nodoc +class __$$InventoryAnalyticSummaryDtoImplCopyWithImpl<$Res> + extends + _$InventoryAnalyticSummaryDtoCopyWithImpl< + $Res, + _$InventoryAnalyticSummaryDtoImpl + > + implements _$$InventoryAnalyticSummaryDtoImplCopyWith<$Res> { + __$$InventoryAnalyticSummaryDtoImplCopyWithImpl( + _$InventoryAnalyticSummaryDtoImpl _value, + $Res Function(_$InventoryAnalyticSummaryDtoImpl) _then, + ) : super(_value, _then); + + /// Create a copy of InventoryAnalyticSummaryDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? totalProducts = freezed, + Object? totalIngredients = freezed, + Object? totalValue = freezed, + Object? lowStockProducts = freezed, + Object? lowStockIngredients = freezed, + Object? zeroStockProducts = freezed, + Object? zeroStockIngredients = freezed, + Object? totalSoldProducts = freezed, + Object? totalSoldIngredients = freezed, + Object? outletId = freezed, + Object? outletName = freezed, + Object? generatedAt = freezed, + }) { + return _then( + _$InventoryAnalyticSummaryDtoImpl( + totalProducts: freezed == totalProducts + ? _value.totalProducts + : totalProducts // ignore: cast_nullable_to_non_nullable + as int?, + totalIngredients: freezed == totalIngredients + ? _value.totalIngredients + : totalIngredients // ignore: cast_nullable_to_non_nullable + as int?, + totalValue: freezed == totalValue + ? _value.totalValue + : totalValue // ignore: cast_nullable_to_non_nullable + as int?, + lowStockProducts: freezed == lowStockProducts + ? _value.lowStockProducts + : lowStockProducts // ignore: cast_nullable_to_non_nullable + as int?, + lowStockIngredients: freezed == lowStockIngredients + ? _value.lowStockIngredients + : lowStockIngredients // ignore: cast_nullable_to_non_nullable + as int?, + zeroStockProducts: freezed == zeroStockProducts + ? _value.zeroStockProducts + : zeroStockProducts // ignore: cast_nullable_to_non_nullable + as int?, + zeroStockIngredients: freezed == zeroStockIngredients + ? _value.zeroStockIngredients + : zeroStockIngredients // ignore: cast_nullable_to_non_nullable + as int?, + totalSoldProducts: freezed == totalSoldProducts + ? _value.totalSoldProducts + : totalSoldProducts // ignore: cast_nullable_to_non_nullable + as int?, + totalSoldIngredients: freezed == totalSoldIngredients + ? _value.totalSoldIngredients + : totalSoldIngredients // ignore: cast_nullable_to_non_nullable + as int?, + outletId: freezed == outletId + ? _value.outletId + : outletId // ignore: cast_nullable_to_non_nullable + as String?, + outletName: freezed == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String?, + generatedAt: freezed == generatedAt + ? _value.generatedAt + : generatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + ), + ); + } +} + +/// @nodoc +@JsonSerializable() +class _$InventoryAnalyticSummaryDtoImpl extends _InventoryAnalyticSummaryDto { + const _$InventoryAnalyticSummaryDtoImpl({ + @JsonKey(name: "total_products") this.totalProducts, + @JsonKey(name: "total_ingredients") this.totalIngredients, + @JsonKey(name: "total_value") this.totalValue, + @JsonKey(name: "low_stock_products") this.lowStockProducts, + @JsonKey(name: "low_stock_ingredients") this.lowStockIngredients, + @JsonKey(name: "zero_stock_products") this.zeroStockProducts, + @JsonKey(name: "zero_stock_ingredients") this.zeroStockIngredients, + @JsonKey(name: "total_sold_products") this.totalSoldProducts, + @JsonKey(name: "total_sold_ingredients") this.totalSoldIngredients, + @JsonKey(name: "outlet_id") this.outletId, + @JsonKey(name: "outlet_name") this.outletName, + @JsonKey(name: "generated_at") this.generatedAt, + }) : super._(); + + factory _$InventoryAnalyticSummaryDtoImpl.fromJson( + Map json, + ) => _$$InventoryAnalyticSummaryDtoImplFromJson(json); + + @override + @JsonKey(name: "total_products") + final int? totalProducts; + @override + @JsonKey(name: "total_ingredients") + final int? totalIngredients; + @override + @JsonKey(name: "total_value") + final int? totalValue; + @override + @JsonKey(name: "low_stock_products") + final int? lowStockProducts; + @override + @JsonKey(name: "low_stock_ingredients") + final int? lowStockIngredients; + @override + @JsonKey(name: "zero_stock_products") + final int? zeroStockProducts; + @override + @JsonKey(name: "zero_stock_ingredients") + final int? zeroStockIngredients; + @override + @JsonKey(name: "total_sold_products") + final int? totalSoldProducts; + @override + @JsonKey(name: "total_sold_ingredients") + final int? totalSoldIngredients; + @override + @JsonKey(name: "outlet_id") + final String? outletId; + @override + @JsonKey(name: "outlet_name") + final String? outletName; + @override + @JsonKey(name: "generated_at") + final DateTime? generatedAt; + + @override + String toString() { + return 'InventoryAnalyticSummaryDto(totalProducts: $totalProducts, totalIngredients: $totalIngredients, totalValue: $totalValue, lowStockProducts: $lowStockProducts, lowStockIngredients: $lowStockIngredients, zeroStockProducts: $zeroStockProducts, zeroStockIngredients: $zeroStockIngredients, totalSoldProducts: $totalSoldProducts, totalSoldIngredients: $totalSoldIngredients, outletId: $outletId, outletName: $outletName, generatedAt: $generatedAt)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$InventoryAnalyticSummaryDtoImpl && + (identical(other.totalProducts, totalProducts) || + other.totalProducts == totalProducts) && + (identical(other.totalIngredients, totalIngredients) || + other.totalIngredients == totalIngredients) && + (identical(other.totalValue, totalValue) || + other.totalValue == totalValue) && + (identical(other.lowStockProducts, lowStockProducts) || + other.lowStockProducts == lowStockProducts) && + (identical(other.lowStockIngredients, lowStockIngredients) || + other.lowStockIngredients == lowStockIngredients) && + (identical(other.zeroStockProducts, zeroStockProducts) || + other.zeroStockProducts == zeroStockProducts) && + (identical(other.zeroStockIngredients, zeroStockIngredients) || + other.zeroStockIngredients == zeroStockIngredients) && + (identical(other.totalSoldProducts, totalSoldProducts) || + other.totalSoldProducts == totalSoldProducts) && + (identical(other.totalSoldIngredients, totalSoldIngredients) || + other.totalSoldIngredients == totalSoldIngredients) && + (identical(other.outletId, outletId) || + other.outletId == outletId) && + (identical(other.outletName, outletName) || + other.outletName == outletName) && + (identical(other.generatedAt, generatedAt) || + other.generatedAt == generatedAt)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + totalProducts, + totalIngredients, + totalValue, + lowStockProducts, + lowStockIngredients, + zeroStockProducts, + zeroStockIngredients, + totalSoldProducts, + totalSoldIngredients, + outletId, + outletName, + generatedAt, + ); + + /// Create a copy of InventoryAnalyticSummaryDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$InventoryAnalyticSummaryDtoImplCopyWith<_$InventoryAnalyticSummaryDtoImpl> + get copyWith => + __$$InventoryAnalyticSummaryDtoImplCopyWithImpl< + _$InventoryAnalyticSummaryDtoImpl + >(this, _$identity); + + @override + Map toJson() { + return _$$InventoryAnalyticSummaryDtoImplToJson(this); + } +} + +abstract class _InventoryAnalyticSummaryDto + extends InventoryAnalyticSummaryDto { + const factory _InventoryAnalyticSummaryDto({ + @JsonKey(name: "total_products") final int? totalProducts, + @JsonKey(name: "total_ingredients") final int? totalIngredients, + @JsonKey(name: "total_value") final int? totalValue, + @JsonKey(name: "low_stock_products") final int? lowStockProducts, + @JsonKey(name: "low_stock_ingredients") final int? lowStockIngredients, + @JsonKey(name: "zero_stock_products") final int? zeroStockProducts, + @JsonKey(name: "zero_stock_ingredients") final int? zeroStockIngredients, + @JsonKey(name: "total_sold_products") final int? totalSoldProducts, + @JsonKey(name: "total_sold_ingredients") final int? totalSoldIngredients, + @JsonKey(name: "outlet_id") final String? outletId, + @JsonKey(name: "outlet_name") final String? outletName, + @JsonKey(name: "generated_at") final DateTime? generatedAt, + }) = _$InventoryAnalyticSummaryDtoImpl; + const _InventoryAnalyticSummaryDto._() : super._(); + + factory _InventoryAnalyticSummaryDto.fromJson(Map json) = + _$InventoryAnalyticSummaryDtoImpl.fromJson; + + @override + @JsonKey(name: "total_products") + int? get totalProducts; + @override + @JsonKey(name: "total_ingredients") + int? get totalIngredients; + @override + @JsonKey(name: "total_value") + int? get totalValue; + @override + @JsonKey(name: "low_stock_products") + int? get lowStockProducts; + @override + @JsonKey(name: "low_stock_ingredients") + int? get lowStockIngredients; + @override + @JsonKey(name: "zero_stock_products") + int? get zeroStockProducts; + @override + @JsonKey(name: "zero_stock_ingredients") + int? get zeroStockIngredients; + @override + @JsonKey(name: "total_sold_products") + int? get totalSoldProducts; + @override + @JsonKey(name: "total_sold_ingredients") + int? get totalSoldIngredients; + @override + @JsonKey(name: "outlet_id") + String? get outletId; + @override + @JsonKey(name: "outlet_name") + String? get outletName; + @override + @JsonKey(name: "generated_at") + DateTime? get generatedAt; + + /// Create a copy of InventoryAnalyticSummaryDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$InventoryAnalyticSummaryDtoImplCopyWith<_$InventoryAnalyticSummaryDtoImpl> + get copyWith => throw _privateConstructorUsedError; +} + +InventoryAnalyticProductItemDto _$InventoryAnalyticProductItemDtoFromJson( + Map json, +) { + return _InventoryAnalyticProductItemDto.fromJson(json); +} + +/// @nodoc +mixin _$InventoryAnalyticProductItemDto { + @JsonKey(name: "id") + String? get id => throw _privateConstructorUsedError; + @JsonKey(name: "product_id") + String? get productId => throw _privateConstructorUsedError; + @JsonKey(name: "product_name") + String? get productName => throw _privateConstructorUsedError; + @JsonKey(name: "category_name") + String? get categoryName => throw _privateConstructorUsedError; + @JsonKey(name: "quantity") + int? get quantity => throw _privateConstructorUsedError; + @JsonKey(name: "reorder_level") + int? get reorderLevel => throw _privateConstructorUsedError; + @JsonKey(name: "unit_cost") + num? get unitCost => throw _privateConstructorUsedError; + @JsonKey(name: "total_value") + int? get totalValue => throw _privateConstructorUsedError; + @JsonKey(name: "total_in") + int? get totalIn => throw _privateConstructorUsedError; + @JsonKey(name: "total_out") + int? get totalOut => throw _privateConstructorUsedError; + @JsonKey(name: "is_low_stock") + bool? get isLowStock => throw _privateConstructorUsedError; + @JsonKey(name: "is_zero_stock") + bool? get isZeroStock => throw _privateConstructorUsedError; + @JsonKey(name: "updated_at") + DateTime? get updatedAt => throw _privateConstructorUsedError; + + /// Serializes this InventoryAnalyticProductItemDto to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of InventoryAnalyticProductItemDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $InventoryAnalyticProductItemDtoCopyWith + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $InventoryAnalyticProductItemDtoCopyWith<$Res> { + factory $InventoryAnalyticProductItemDtoCopyWith( + InventoryAnalyticProductItemDto value, + $Res Function(InventoryAnalyticProductItemDto) then, + ) = + _$InventoryAnalyticProductItemDtoCopyWithImpl< + $Res, + InventoryAnalyticProductItemDto + >; + @useResult + $Res call({ + @JsonKey(name: "id") String? id, + @JsonKey(name: "product_id") String? productId, + @JsonKey(name: "product_name") String? productName, + @JsonKey(name: "category_name") String? categoryName, + @JsonKey(name: "quantity") int? quantity, + @JsonKey(name: "reorder_level") int? reorderLevel, + @JsonKey(name: "unit_cost") num? unitCost, + @JsonKey(name: "total_value") int? totalValue, + @JsonKey(name: "total_in") int? totalIn, + @JsonKey(name: "total_out") int? totalOut, + @JsonKey(name: "is_low_stock") bool? isLowStock, + @JsonKey(name: "is_zero_stock") bool? isZeroStock, + @JsonKey(name: "updated_at") DateTime? updatedAt, + }); +} + +/// @nodoc +class _$InventoryAnalyticProductItemDtoCopyWithImpl< + $Res, + $Val extends InventoryAnalyticProductItemDto +> + implements $InventoryAnalyticProductItemDtoCopyWith<$Res> { + _$InventoryAnalyticProductItemDtoCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of InventoryAnalyticProductItemDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = freezed, + Object? productId = freezed, + Object? productName = freezed, + Object? categoryName = freezed, + Object? quantity = freezed, + Object? reorderLevel = freezed, + Object? unitCost = freezed, + Object? totalValue = freezed, + Object? totalIn = freezed, + Object? totalOut = freezed, + Object? isLowStock = freezed, + Object? isZeroStock = freezed, + Object? updatedAt = freezed, + }) { + return _then( + _value.copyWith( + id: freezed == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + productId: freezed == productId + ? _value.productId + : productId // ignore: cast_nullable_to_non_nullable + as String?, + productName: freezed == productName + ? _value.productName + : productName // ignore: cast_nullable_to_non_nullable + as String?, + categoryName: freezed == categoryName + ? _value.categoryName + : categoryName // ignore: cast_nullable_to_non_nullable + as String?, + quantity: freezed == quantity + ? _value.quantity + : quantity // ignore: cast_nullable_to_non_nullable + as int?, + reorderLevel: freezed == reorderLevel + ? _value.reorderLevel + : reorderLevel // ignore: cast_nullable_to_non_nullable + as int?, + unitCost: freezed == unitCost + ? _value.unitCost + : unitCost // ignore: cast_nullable_to_non_nullable + as num?, + totalValue: freezed == totalValue + ? _value.totalValue + : totalValue // ignore: cast_nullable_to_non_nullable + as int?, + totalIn: freezed == totalIn + ? _value.totalIn + : totalIn // ignore: cast_nullable_to_non_nullable + as int?, + totalOut: freezed == totalOut + ? _value.totalOut + : totalOut // ignore: cast_nullable_to_non_nullable + as int?, + isLowStock: freezed == isLowStock + ? _value.isLowStock + : isLowStock // ignore: cast_nullable_to_non_nullable + as bool?, + isZeroStock: freezed == isZeroStock + ? _value.isZeroStock + : isZeroStock // ignore: cast_nullable_to_non_nullable + as bool?, + updatedAt: freezed == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + ) + as $Val, + ); + } +} + +/// @nodoc +abstract class _$$InventoryAnalyticProductItemDtoImplCopyWith<$Res> + implements $InventoryAnalyticProductItemDtoCopyWith<$Res> { + factory _$$InventoryAnalyticProductItemDtoImplCopyWith( + _$InventoryAnalyticProductItemDtoImpl value, + $Res Function(_$InventoryAnalyticProductItemDtoImpl) then, + ) = __$$InventoryAnalyticProductItemDtoImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({ + @JsonKey(name: "id") String? id, + @JsonKey(name: "product_id") String? productId, + @JsonKey(name: "product_name") String? productName, + @JsonKey(name: "category_name") String? categoryName, + @JsonKey(name: "quantity") int? quantity, + @JsonKey(name: "reorder_level") int? reorderLevel, + @JsonKey(name: "unit_cost") num? unitCost, + @JsonKey(name: "total_value") int? totalValue, + @JsonKey(name: "total_in") int? totalIn, + @JsonKey(name: "total_out") int? totalOut, + @JsonKey(name: "is_low_stock") bool? isLowStock, + @JsonKey(name: "is_zero_stock") bool? isZeroStock, + @JsonKey(name: "updated_at") DateTime? updatedAt, + }); +} + +/// @nodoc +class __$$InventoryAnalyticProductItemDtoImplCopyWithImpl<$Res> + extends + _$InventoryAnalyticProductItemDtoCopyWithImpl< + $Res, + _$InventoryAnalyticProductItemDtoImpl + > + implements _$$InventoryAnalyticProductItemDtoImplCopyWith<$Res> { + __$$InventoryAnalyticProductItemDtoImplCopyWithImpl( + _$InventoryAnalyticProductItemDtoImpl _value, + $Res Function(_$InventoryAnalyticProductItemDtoImpl) _then, + ) : super(_value, _then); + + /// Create a copy of InventoryAnalyticProductItemDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = freezed, + Object? productId = freezed, + Object? productName = freezed, + Object? categoryName = freezed, + Object? quantity = freezed, + Object? reorderLevel = freezed, + Object? unitCost = freezed, + Object? totalValue = freezed, + Object? totalIn = freezed, + Object? totalOut = freezed, + Object? isLowStock = freezed, + Object? isZeroStock = freezed, + Object? updatedAt = freezed, + }) { + return _then( + _$InventoryAnalyticProductItemDtoImpl( + id: freezed == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + productId: freezed == productId + ? _value.productId + : productId // ignore: cast_nullable_to_non_nullable + as String?, + productName: freezed == productName + ? _value.productName + : productName // ignore: cast_nullable_to_non_nullable + as String?, + categoryName: freezed == categoryName + ? _value.categoryName + : categoryName // ignore: cast_nullable_to_non_nullable + as String?, + quantity: freezed == quantity + ? _value.quantity + : quantity // ignore: cast_nullable_to_non_nullable + as int?, + reorderLevel: freezed == reorderLevel + ? _value.reorderLevel + : reorderLevel // ignore: cast_nullable_to_non_nullable + as int?, + unitCost: freezed == unitCost + ? _value.unitCost + : unitCost // ignore: cast_nullable_to_non_nullable + as num?, + totalValue: freezed == totalValue + ? _value.totalValue + : totalValue // ignore: cast_nullable_to_non_nullable + as int?, + totalIn: freezed == totalIn + ? _value.totalIn + : totalIn // ignore: cast_nullable_to_non_nullable + as int?, + totalOut: freezed == totalOut + ? _value.totalOut + : totalOut // ignore: cast_nullable_to_non_nullable + as int?, + isLowStock: freezed == isLowStock + ? _value.isLowStock + : isLowStock // ignore: cast_nullable_to_non_nullable + as bool?, + isZeroStock: freezed == isZeroStock + ? _value.isZeroStock + : isZeroStock // ignore: cast_nullable_to_non_nullable + as bool?, + updatedAt: freezed == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + ), + ); + } +} + +/// @nodoc +@JsonSerializable() +class _$InventoryAnalyticProductItemDtoImpl + extends _InventoryAnalyticProductItemDto { + const _$InventoryAnalyticProductItemDtoImpl({ + @JsonKey(name: "id") this.id, + @JsonKey(name: "product_id") this.productId, + @JsonKey(name: "product_name") this.productName, + @JsonKey(name: "category_name") this.categoryName, + @JsonKey(name: "quantity") this.quantity, + @JsonKey(name: "reorder_level") this.reorderLevel, + @JsonKey(name: "unit_cost") this.unitCost, + @JsonKey(name: "total_value") this.totalValue, + @JsonKey(name: "total_in") this.totalIn, + @JsonKey(name: "total_out") this.totalOut, + @JsonKey(name: "is_low_stock") this.isLowStock, + @JsonKey(name: "is_zero_stock") this.isZeroStock, + @JsonKey(name: "updated_at") this.updatedAt, + }) : super._(); + + factory _$InventoryAnalyticProductItemDtoImpl.fromJson( + Map json, + ) => _$$InventoryAnalyticProductItemDtoImplFromJson(json); + + @override + @JsonKey(name: "id") + final String? id; + @override + @JsonKey(name: "product_id") + final String? productId; + @override + @JsonKey(name: "product_name") + final String? productName; + @override + @JsonKey(name: "category_name") + final String? categoryName; + @override + @JsonKey(name: "quantity") + final int? quantity; + @override + @JsonKey(name: "reorder_level") + final int? reorderLevel; + @override + @JsonKey(name: "unit_cost") + final num? unitCost; + @override + @JsonKey(name: "total_value") + final int? totalValue; + @override + @JsonKey(name: "total_in") + final int? totalIn; + @override + @JsonKey(name: "total_out") + final int? totalOut; + @override + @JsonKey(name: "is_low_stock") + final bool? isLowStock; + @override + @JsonKey(name: "is_zero_stock") + final bool? isZeroStock; + @override + @JsonKey(name: "updated_at") + final DateTime? updatedAt; + + @override + String toString() { + return 'InventoryAnalyticProductItemDto(id: $id, productId: $productId, productName: $productName, categoryName: $categoryName, quantity: $quantity, reorderLevel: $reorderLevel, unitCost: $unitCost, totalValue: $totalValue, totalIn: $totalIn, totalOut: $totalOut, isLowStock: $isLowStock, isZeroStock: $isZeroStock, updatedAt: $updatedAt)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$InventoryAnalyticProductItemDtoImpl && + (identical(other.id, id) || other.id == id) && + (identical(other.productId, productId) || + other.productId == productId) && + (identical(other.productName, productName) || + other.productName == productName) && + (identical(other.categoryName, categoryName) || + other.categoryName == categoryName) && + (identical(other.quantity, quantity) || + other.quantity == quantity) && + (identical(other.reorderLevel, reorderLevel) || + other.reorderLevel == reorderLevel) && + (identical(other.unitCost, unitCost) || + other.unitCost == unitCost) && + (identical(other.totalValue, totalValue) || + other.totalValue == totalValue) && + (identical(other.totalIn, totalIn) || other.totalIn == totalIn) && + (identical(other.totalOut, totalOut) || + other.totalOut == totalOut) && + (identical(other.isLowStock, isLowStock) || + other.isLowStock == isLowStock) && + (identical(other.isZeroStock, isZeroStock) || + other.isZeroStock == isZeroStock) && + (identical(other.updatedAt, updatedAt) || + other.updatedAt == updatedAt)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + id, + productId, + productName, + categoryName, + quantity, + reorderLevel, + unitCost, + totalValue, + totalIn, + totalOut, + isLowStock, + isZeroStock, + updatedAt, + ); + + /// Create a copy of InventoryAnalyticProductItemDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$InventoryAnalyticProductItemDtoImplCopyWith< + _$InventoryAnalyticProductItemDtoImpl + > + get copyWith => + __$$InventoryAnalyticProductItemDtoImplCopyWithImpl< + _$InventoryAnalyticProductItemDtoImpl + >(this, _$identity); + + @override + Map toJson() { + return _$$InventoryAnalyticProductItemDtoImplToJson(this); + } +} + +abstract class _InventoryAnalyticProductItemDto + extends InventoryAnalyticProductItemDto { + const factory _InventoryAnalyticProductItemDto({ + @JsonKey(name: "id") final String? id, + @JsonKey(name: "product_id") final String? productId, + @JsonKey(name: "product_name") final String? productName, + @JsonKey(name: "category_name") final String? categoryName, + @JsonKey(name: "quantity") final int? quantity, + @JsonKey(name: "reorder_level") final int? reorderLevel, + @JsonKey(name: "unit_cost") final num? unitCost, + @JsonKey(name: "total_value") final int? totalValue, + @JsonKey(name: "total_in") final int? totalIn, + @JsonKey(name: "total_out") final int? totalOut, + @JsonKey(name: "is_low_stock") final bool? isLowStock, + @JsonKey(name: "is_zero_stock") final bool? isZeroStock, + @JsonKey(name: "updated_at") final DateTime? updatedAt, + }) = _$InventoryAnalyticProductItemDtoImpl; + const _InventoryAnalyticProductItemDto._() : super._(); + + factory _InventoryAnalyticProductItemDto.fromJson(Map json) = + _$InventoryAnalyticProductItemDtoImpl.fromJson; + + @override + @JsonKey(name: "id") + String? get id; + @override + @JsonKey(name: "product_id") + String? get productId; + @override + @JsonKey(name: "product_name") + String? get productName; + @override + @JsonKey(name: "category_name") + String? get categoryName; + @override + @JsonKey(name: "quantity") + int? get quantity; + @override + @JsonKey(name: "reorder_level") + int? get reorderLevel; + @override + @JsonKey(name: "unit_cost") + num? get unitCost; + @override + @JsonKey(name: "total_value") + int? get totalValue; + @override + @JsonKey(name: "total_in") + int? get totalIn; + @override + @JsonKey(name: "total_out") + int? get totalOut; + @override + @JsonKey(name: "is_low_stock") + bool? get isLowStock; + @override + @JsonKey(name: "is_zero_stock") + bool? get isZeroStock; + @override + @JsonKey(name: "updated_at") + DateTime? get updatedAt; + + /// Create a copy of InventoryAnalyticProductItemDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$InventoryAnalyticProductItemDtoImplCopyWith< + _$InventoryAnalyticProductItemDtoImpl + > + get copyWith => throw _privateConstructorUsedError; +} + +InventoryAnalyticIngredientItemDto _$InventoryAnalyticIngredientItemDtoFromJson( + Map json, +) { + return _InventoryAnalyticIngredientItemDto.fromJson(json); +} + +/// @nodoc +mixin _$InventoryAnalyticIngredientItemDto { + @JsonKey(name: "id") + String? get id => throw _privateConstructorUsedError; + @JsonKey(name: "ingredient_id") + String? get ingredientId => throw _privateConstructorUsedError; + @JsonKey(name: "ingredient_name") + String? get ingredientName => throw _privateConstructorUsedError; + @JsonKey(name: "unit_name") + String? get unitName => throw _privateConstructorUsedError; + @JsonKey(name: "quantity") + int? get quantity => throw _privateConstructorUsedError; + @JsonKey(name: "reorder_level") + int? get reorderLevel => throw _privateConstructorUsedError; + @JsonKey(name: "unit_cost") + num? get unitCost => throw _privateConstructorUsedError; + @JsonKey(name: "total_value") + int? get totalValue => throw _privateConstructorUsedError; + @JsonKey(name: "total_in") + int? get totalIn => throw _privateConstructorUsedError; + @JsonKey(name: "total_out") + int? get totalOut => throw _privateConstructorUsedError; + @JsonKey(name: "is_low_stock") + bool? get isLowStock => throw _privateConstructorUsedError; + @JsonKey(name: "is_zero_stock") + bool? get isZeroStock => throw _privateConstructorUsedError; + @JsonKey(name: "updated_at") + DateTime? get updatedAt => throw _privateConstructorUsedError; + + /// Serializes this InventoryAnalyticIngredientItemDto to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of InventoryAnalyticIngredientItemDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $InventoryAnalyticIngredientItemDtoCopyWith< + InventoryAnalyticIngredientItemDto + > + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $InventoryAnalyticIngredientItemDtoCopyWith<$Res> { + factory $InventoryAnalyticIngredientItemDtoCopyWith( + InventoryAnalyticIngredientItemDto value, + $Res Function(InventoryAnalyticIngredientItemDto) then, + ) = + _$InventoryAnalyticIngredientItemDtoCopyWithImpl< + $Res, + InventoryAnalyticIngredientItemDto + >; + @useResult + $Res call({ + @JsonKey(name: "id") String? id, + @JsonKey(name: "ingredient_id") String? ingredientId, + @JsonKey(name: "ingredient_name") String? ingredientName, + @JsonKey(name: "unit_name") String? unitName, + @JsonKey(name: "quantity") int? quantity, + @JsonKey(name: "reorder_level") int? reorderLevel, + @JsonKey(name: "unit_cost") num? unitCost, + @JsonKey(name: "total_value") int? totalValue, + @JsonKey(name: "total_in") int? totalIn, + @JsonKey(name: "total_out") int? totalOut, + @JsonKey(name: "is_low_stock") bool? isLowStock, + @JsonKey(name: "is_zero_stock") bool? isZeroStock, + @JsonKey(name: "updated_at") DateTime? updatedAt, + }); +} + +/// @nodoc +class _$InventoryAnalyticIngredientItemDtoCopyWithImpl< + $Res, + $Val extends InventoryAnalyticIngredientItemDto +> + implements $InventoryAnalyticIngredientItemDtoCopyWith<$Res> { + _$InventoryAnalyticIngredientItemDtoCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of InventoryAnalyticIngredientItemDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = freezed, + Object? ingredientId = freezed, + Object? ingredientName = freezed, + Object? unitName = freezed, + Object? quantity = freezed, + Object? reorderLevel = freezed, + Object? unitCost = freezed, + Object? totalValue = freezed, + Object? totalIn = freezed, + Object? totalOut = freezed, + Object? isLowStock = freezed, + Object? isZeroStock = freezed, + Object? updatedAt = freezed, + }) { + return _then( + _value.copyWith( + id: freezed == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + ingredientId: freezed == ingredientId + ? _value.ingredientId + : ingredientId // ignore: cast_nullable_to_non_nullable + as String?, + ingredientName: freezed == ingredientName + ? _value.ingredientName + : ingredientName // ignore: cast_nullable_to_non_nullable + as String?, + unitName: freezed == unitName + ? _value.unitName + : unitName // ignore: cast_nullable_to_non_nullable + as String?, + quantity: freezed == quantity + ? _value.quantity + : quantity // ignore: cast_nullable_to_non_nullable + as int?, + reorderLevel: freezed == reorderLevel + ? _value.reorderLevel + : reorderLevel // ignore: cast_nullable_to_non_nullable + as int?, + unitCost: freezed == unitCost + ? _value.unitCost + : unitCost // ignore: cast_nullable_to_non_nullable + as num?, + totalValue: freezed == totalValue + ? _value.totalValue + : totalValue // ignore: cast_nullable_to_non_nullable + as int?, + totalIn: freezed == totalIn + ? _value.totalIn + : totalIn // ignore: cast_nullable_to_non_nullable + as int?, + totalOut: freezed == totalOut + ? _value.totalOut + : totalOut // ignore: cast_nullable_to_non_nullable + as int?, + isLowStock: freezed == isLowStock + ? _value.isLowStock + : isLowStock // ignore: cast_nullable_to_non_nullable + as bool?, + isZeroStock: freezed == isZeroStock + ? _value.isZeroStock + : isZeroStock // ignore: cast_nullable_to_non_nullable + as bool?, + updatedAt: freezed == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + ) + as $Val, + ); + } +} + +/// @nodoc +abstract class _$$InventoryAnalyticIngredientItemDtoImplCopyWith<$Res> + implements $InventoryAnalyticIngredientItemDtoCopyWith<$Res> { + factory _$$InventoryAnalyticIngredientItemDtoImplCopyWith( + _$InventoryAnalyticIngredientItemDtoImpl value, + $Res Function(_$InventoryAnalyticIngredientItemDtoImpl) then, + ) = __$$InventoryAnalyticIngredientItemDtoImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({ + @JsonKey(name: "id") String? id, + @JsonKey(name: "ingredient_id") String? ingredientId, + @JsonKey(name: "ingredient_name") String? ingredientName, + @JsonKey(name: "unit_name") String? unitName, + @JsonKey(name: "quantity") int? quantity, + @JsonKey(name: "reorder_level") int? reorderLevel, + @JsonKey(name: "unit_cost") num? unitCost, + @JsonKey(name: "total_value") int? totalValue, + @JsonKey(name: "total_in") int? totalIn, + @JsonKey(name: "total_out") int? totalOut, + @JsonKey(name: "is_low_stock") bool? isLowStock, + @JsonKey(name: "is_zero_stock") bool? isZeroStock, + @JsonKey(name: "updated_at") DateTime? updatedAt, + }); +} + +/// @nodoc +class __$$InventoryAnalyticIngredientItemDtoImplCopyWithImpl<$Res> + extends + _$InventoryAnalyticIngredientItemDtoCopyWithImpl< + $Res, + _$InventoryAnalyticIngredientItemDtoImpl + > + implements _$$InventoryAnalyticIngredientItemDtoImplCopyWith<$Res> { + __$$InventoryAnalyticIngredientItemDtoImplCopyWithImpl( + _$InventoryAnalyticIngredientItemDtoImpl _value, + $Res Function(_$InventoryAnalyticIngredientItemDtoImpl) _then, + ) : super(_value, _then); + + /// Create a copy of InventoryAnalyticIngredientItemDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = freezed, + Object? ingredientId = freezed, + Object? ingredientName = freezed, + Object? unitName = freezed, + Object? quantity = freezed, + Object? reorderLevel = freezed, + Object? unitCost = freezed, + Object? totalValue = freezed, + Object? totalIn = freezed, + Object? totalOut = freezed, + Object? isLowStock = freezed, + Object? isZeroStock = freezed, + Object? updatedAt = freezed, + }) { + return _then( + _$InventoryAnalyticIngredientItemDtoImpl( + id: freezed == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + ingredientId: freezed == ingredientId + ? _value.ingredientId + : ingredientId // ignore: cast_nullable_to_non_nullable + as String?, + ingredientName: freezed == ingredientName + ? _value.ingredientName + : ingredientName // ignore: cast_nullable_to_non_nullable + as String?, + unitName: freezed == unitName + ? _value.unitName + : unitName // ignore: cast_nullable_to_non_nullable + as String?, + quantity: freezed == quantity + ? _value.quantity + : quantity // ignore: cast_nullable_to_non_nullable + as int?, + reorderLevel: freezed == reorderLevel + ? _value.reorderLevel + : reorderLevel // ignore: cast_nullable_to_non_nullable + as int?, + unitCost: freezed == unitCost + ? _value.unitCost + : unitCost // ignore: cast_nullable_to_non_nullable + as num?, + totalValue: freezed == totalValue + ? _value.totalValue + : totalValue // ignore: cast_nullable_to_non_nullable + as int?, + totalIn: freezed == totalIn + ? _value.totalIn + : totalIn // ignore: cast_nullable_to_non_nullable + as int?, + totalOut: freezed == totalOut + ? _value.totalOut + : totalOut // ignore: cast_nullable_to_non_nullable + as int?, + isLowStock: freezed == isLowStock + ? _value.isLowStock + : isLowStock // ignore: cast_nullable_to_non_nullable + as bool?, + isZeroStock: freezed == isZeroStock + ? _value.isZeroStock + : isZeroStock // ignore: cast_nullable_to_non_nullable + as bool?, + updatedAt: freezed == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + ), + ); + } +} + +/// @nodoc +@JsonSerializable() +class _$InventoryAnalyticIngredientItemDtoImpl + extends _InventoryAnalyticIngredientItemDto { + const _$InventoryAnalyticIngredientItemDtoImpl({ + @JsonKey(name: "id") this.id, + @JsonKey(name: "ingredient_id") this.ingredientId, + @JsonKey(name: "ingredient_name") this.ingredientName, + @JsonKey(name: "unit_name") this.unitName, + @JsonKey(name: "quantity") this.quantity, + @JsonKey(name: "reorder_level") this.reorderLevel, + @JsonKey(name: "unit_cost") this.unitCost, + @JsonKey(name: "total_value") this.totalValue, + @JsonKey(name: "total_in") this.totalIn, + @JsonKey(name: "total_out") this.totalOut, + @JsonKey(name: "is_low_stock") this.isLowStock, + @JsonKey(name: "is_zero_stock") this.isZeroStock, + @JsonKey(name: "updated_at") this.updatedAt, + }) : super._(); + + factory _$InventoryAnalyticIngredientItemDtoImpl.fromJson( + Map json, + ) => _$$InventoryAnalyticIngredientItemDtoImplFromJson(json); + + @override + @JsonKey(name: "id") + final String? id; + @override + @JsonKey(name: "ingredient_id") + final String? ingredientId; + @override + @JsonKey(name: "ingredient_name") + final String? ingredientName; + @override + @JsonKey(name: "unit_name") + final String? unitName; + @override + @JsonKey(name: "quantity") + final int? quantity; + @override + @JsonKey(name: "reorder_level") + final int? reorderLevel; + @override + @JsonKey(name: "unit_cost") + final num? unitCost; + @override + @JsonKey(name: "total_value") + final int? totalValue; + @override + @JsonKey(name: "total_in") + final int? totalIn; + @override + @JsonKey(name: "total_out") + final int? totalOut; + @override + @JsonKey(name: "is_low_stock") + final bool? isLowStock; + @override + @JsonKey(name: "is_zero_stock") + final bool? isZeroStock; + @override + @JsonKey(name: "updated_at") + final DateTime? updatedAt; + + @override + String toString() { + return 'InventoryAnalyticIngredientItemDto(id: $id, ingredientId: $ingredientId, ingredientName: $ingredientName, unitName: $unitName, quantity: $quantity, reorderLevel: $reorderLevel, unitCost: $unitCost, totalValue: $totalValue, totalIn: $totalIn, totalOut: $totalOut, isLowStock: $isLowStock, isZeroStock: $isZeroStock, updatedAt: $updatedAt)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$InventoryAnalyticIngredientItemDtoImpl && + (identical(other.id, id) || other.id == id) && + (identical(other.ingredientId, ingredientId) || + other.ingredientId == ingredientId) && + (identical(other.ingredientName, ingredientName) || + other.ingredientName == ingredientName) && + (identical(other.unitName, unitName) || + other.unitName == unitName) && + (identical(other.quantity, quantity) || + other.quantity == quantity) && + (identical(other.reorderLevel, reorderLevel) || + other.reorderLevel == reorderLevel) && + (identical(other.unitCost, unitCost) || + other.unitCost == unitCost) && + (identical(other.totalValue, totalValue) || + other.totalValue == totalValue) && + (identical(other.totalIn, totalIn) || other.totalIn == totalIn) && + (identical(other.totalOut, totalOut) || + other.totalOut == totalOut) && + (identical(other.isLowStock, isLowStock) || + other.isLowStock == isLowStock) && + (identical(other.isZeroStock, isZeroStock) || + other.isZeroStock == isZeroStock) && + (identical(other.updatedAt, updatedAt) || + other.updatedAt == updatedAt)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + id, + ingredientId, + ingredientName, + unitName, + quantity, + reorderLevel, + unitCost, + totalValue, + totalIn, + totalOut, + isLowStock, + isZeroStock, + updatedAt, + ); + + /// Create a copy of InventoryAnalyticIngredientItemDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$InventoryAnalyticIngredientItemDtoImplCopyWith< + _$InventoryAnalyticIngredientItemDtoImpl + > + get copyWith => + __$$InventoryAnalyticIngredientItemDtoImplCopyWithImpl< + _$InventoryAnalyticIngredientItemDtoImpl + >(this, _$identity); + + @override + Map toJson() { + return _$$InventoryAnalyticIngredientItemDtoImplToJson(this); + } +} + +abstract class _InventoryAnalyticIngredientItemDto + extends InventoryAnalyticIngredientItemDto { + const factory _InventoryAnalyticIngredientItemDto({ + @JsonKey(name: "id") final String? id, + @JsonKey(name: "ingredient_id") final String? ingredientId, + @JsonKey(name: "ingredient_name") final String? ingredientName, + @JsonKey(name: "unit_name") final String? unitName, + @JsonKey(name: "quantity") final int? quantity, + @JsonKey(name: "reorder_level") final int? reorderLevel, + @JsonKey(name: "unit_cost") final num? unitCost, + @JsonKey(name: "total_value") final int? totalValue, + @JsonKey(name: "total_in") final int? totalIn, + @JsonKey(name: "total_out") final int? totalOut, + @JsonKey(name: "is_low_stock") final bool? isLowStock, + @JsonKey(name: "is_zero_stock") final bool? isZeroStock, + @JsonKey(name: "updated_at") final DateTime? updatedAt, + }) = _$InventoryAnalyticIngredientItemDtoImpl; + const _InventoryAnalyticIngredientItemDto._() : super._(); + + factory _InventoryAnalyticIngredientItemDto.fromJson( + Map json, + ) = _$InventoryAnalyticIngredientItemDtoImpl.fromJson; + + @override + @JsonKey(name: "id") + String? get id; + @override + @JsonKey(name: "ingredient_id") + String? get ingredientId; + @override + @JsonKey(name: "ingredient_name") + String? get ingredientName; + @override + @JsonKey(name: "unit_name") + String? get unitName; + @override + @JsonKey(name: "quantity") + int? get quantity; + @override + @JsonKey(name: "reorder_level") + int? get reorderLevel; + @override + @JsonKey(name: "unit_cost") + num? get unitCost; + @override + @JsonKey(name: "total_value") + int? get totalValue; + @override + @JsonKey(name: "total_in") + int? get totalIn; + @override + @JsonKey(name: "total_out") + int? get totalOut; + @override + @JsonKey(name: "is_low_stock") + bool? get isLowStock; + @override + @JsonKey(name: "is_zero_stock") + bool? get isZeroStock; + @override + @JsonKey(name: "updated_at") + DateTime? get updatedAt; + + /// Create a copy of InventoryAnalyticIngredientItemDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$InventoryAnalyticIngredientItemDtoImplCopyWith< + _$InventoryAnalyticIngredientItemDtoImpl + > + get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/infrastructure/analytic/analytic_dtos.g.dart b/lib/infrastructure/analytic/analytic_dtos.g.dart index feac7c7..be485b9 100644 --- a/lib/infrastructure/analytic/analytic_dtos.g.dart +++ b/lib/infrastructure/analytic/analytic_dtos.g.dart @@ -527,3 +527,146 @@ Map _$$CategoryAnalyticItemDtoImplToJson( 'product_count': instance.productCount, 'order_count': instance.orderCount, }; + +_$InventoryAnalyticDtoImpl _$$InventoryAnalyticDtoImplFromJson( + Map json, +) => _$InventoryAnalyticDtoImpl( + summary: json['summary'] == null + ? null + : InventoryAnalyticSummaryDto.fromJson( + json['summary'] as Map, + ), + products: (json['products'] as List?) + ?.map( + (e) => + InventoryAnalyticProductItemDto.fromJson(e as Map), + ) + .toList(), + ingredients: (json['ingredients'] as List?) + ?.map( + (e) => InventoryAnalyticIngredientItemDto.fromJson( + e as Map, + ), + ) + .toList(), +); + +Map _$$InventoryAnalyticDtoImplToJson( + _$InventoryAnalyticDtoImpl instance, +) => { + 'summary': instance.summary, + 'products': instance.products, + 'ingredients': instance.ingredients, +}; + +_$InventoryAnalyticSummaryDtoImpl _$$InventoryAnalyticSummaryDtoImplFromJson( + Map json, +) => _$InventoryAnalyticSummaryDtoImpl( + totalProducts: (json['total_products'] as num?)?.toInt(), + totalIngredients: (json['total_ingredients'] as num?)?.toInt(), + totalValue: (json['total_value'] as num?)?.toInt(), + lowStockProducts: (json['low_stock_products'] as num?)?.toInt(), + lowStockIngredients: (json['low_stock_ingredients'] as num?)?.toInt(), + zeroStockProducts: (json['zero_stock_products'] as num?)?.toInt(), + zeroStockIngredients: (json['zero_stock_ingredients'] as num?)?.toInt(), + totalSoldProducts: (json['total_sold_products'] as num?)?.toInt(), + totalSoldIngredients: (json['total_sold_ingredients'] as num?)?.toInt(), + outletId: json['outlet_id'] as String?, + outletName: json['outlet_name'] as String?, + generatedAt: json['generated_at'] == null + ? null + : DateTime.parse(json['generated_at'] as String), +); + +Map _$$InventoryAnalyticSummaryDtoImplToJson( + _$InventoryAnalyticSummaryDtoImpl instance, +) => { + 'total_products': instance.totalProducts, + 'total_ingredients': instance.totalIngredients, + 'total_value': instance.totalValue, + 'low_stock_products': instance.lowStockProducts, + 'low_stock_ingredients': instance.lowStockIngredients, + 'zero_stock_products': instance.zeroStockProducts, + 'zero_stock_ingredients': instance.zeroStockIngredients, + 'total_sold_products': instance.totalSoldProducts, + 'total_sold_ingredients': instance.totalSoldIngredients, + 'outlet_id': instance.outletId, + 'outlet_name': instance.outletName, + 'generated_at': instance.generatedAt?.toIso8601String(), +}; + +_$InventoryAnalyticProductItemDtoImpl +_$$InventoryAnalyticProductItemDtoImplFromJson(Map json) => + _$InventoryAnalyticProductItemDtoImpl( + id: json['id'] as String?, + productId: json['product_id'] as String?, + productName: json['product_name'] as String?, + categoryName: json['category_name'] as String?, + quantity: (json['quantity'] as num?)?.toInt(), + reorderLevel: (json['reorder_level'] as num?)?.toInt(), + unitCost: json['unit_cost'] as num?, + totalValue: (json['total_value'] as num?)?.toInt(), + totalIn: (json['total_in'] as num?)?.toInt(), + totalOut: (json['total_out'] as num?)?.toInt(), + isLowStock: json['is_low_stock'] as bool?, + isZeroStock: json['is_zero_stock'] as bool?, + updatedAt: json['updated_at'] == null + ? null + : DateTime.parse(json['updated_at'] as String), + ); + +Map _$$InventoryAnalyticProductItemDtoImplToJson( + _$InventoryAnalyticProductItemDtoImpl instance, +) => { + 'id': instance.id, + 'product_id': instance.productId, + 'product_name': instance.productName, + 'category_name': instance.categoryName, + 'quantity': instance.quantity, + 'reorder_level': instance.reorderLevel, + 'unit_cost': instance.unitCost, + 'total_value': instance.totalValue, + 'total_in': instance.totalIn, + 'total_out': instance.totalOut, + 'is_low_stock': instance.isLowStock, + 'is_zero_stock': instance.isZeroStock, + 'updated_at': instance.updatedAt?.toIso8601String(), +}; + +_$InventoryAnalyticIngredientItemDtoImpl +_$$InventoryAnalyticIngredientItemDtoImplFromJson(Map json) => + _$InventoryAnalyticIngredientItemDtoImpl( + id: json['id'] as String?, + ingredientId: json['ingredient_id'] as String?, + ingredientName: json['ingredient_name'] as String?, + unitName: json['unit_name'] as String?, + quantity: (json['quantity'] as num?)?.toInt(), + reorderLevel: (json['reorder_level'] as num?)?.toInt(), + unitCost: json['unit_cost'] as num?, + totalValue: (json['total_value'] as num?)?.toInt(), + totalIn: (json['total_in'] as num?)?.toInt(), + totalOut: (json['total_out'] as num?)?.toInt(), + isLowStock: json['is_low_stock'] as bool?, + isZeroStock: json['is_zero_stock'] as bool?, + updatedAt: json['updated_at'] == null + ? null + : DateTime.parse(json['updated_at'] as String), + ); + +Map _$$InventoryAnalyticIngredientItemDtoImplToJson( + _$InventoryAnalyticIngredientItemDtoImpl instance, +) => { + 'id': instance.id, + 'ingredient_id': instance.ingredientId, + 'ingredient_name': instance.ingredientName, + 'unit_name': instance.unitName, + 'quantity': instance.quantity, + 'reorder_level': instance.reorderLevel, + 'unit_cost': instance.unitCost, + 'total_value': instance.totalValue, + 'total_in': instance.totalIn, + 'total_out': instance.totalOut, + 'is_low_stock': instance.isLowStock, + 'is_zero_stock': instance.isZeroStock, + 'updated_at': instance.updatedAt?.toIso8601String(), +}; diff --git a/lib/infrastructure/analytic/datasources/remote_data_provider.dart b/lib/infrastructure/analytic/datasources/remote_data_provider.dart index 3a1028a..b9442f7 100644 --- a/lib/infrastructure/analytic/datasources/remote_data_provider.dart +++ b/lib/infrastructure/analytic/datasources/remote_data_provider.dart @@ -9,6 +9,8 @@ import '../../../common/extension/extension.dart'; import '../../../common/function/app_function.dart'; import '../../../common/url/api_path.dart'; import '../../../domain/analytic/analytic.dart'; +import '../../../injection.dart'; +import '../../outlet/datasources/local_data_provider.dart'; import '../analytic_dtos.dart'; @injectable @@ -192,4 +194,34 @@ class AnalyticRemoteDataProvider { return DC.error(AnalyticFailure.serverError(e)); } } + + Future> fetchInventory({ + required DateTime dateFrom, + required DateTime dateTo, + }) async { + try { + final user = await getIt().currentOutlet(); + final response = await _apiClient.get( + '${ApiPath.analyticInventory}/${user.id}', + params: { + 'date_from': dateFrom.toServerDate(), + 'date_to': dateTo.toServerDate(), + }, + headers: getAuthorizationHeader(), + ); + + if (response.data['success'] == false) { + return DC.error(AnalyticFailure.unexpectedError()); + } + + final inventory = InventoryAnalyticDto.fromJson( + response.data['data'] as Map, + ); + + return DC.data(inventory); + } on ApiFailure catch (e, s) { + log('fetchInventory', name: _logName, error: e, stackTrace: s); + return DC.error(AnalyticFailure.serverError(e)); + } + } } diff --git a/lib/infrastructure/analytic/dtos/inventory_analytic_dto.dart b/lib/infrastructure/analytic/dtos/inventory_analytic_dto.dart new file mode 100644 index 0000000..fb77144 --- /dev/null +++ b/lib/infrastructure/analytic/dtos/inventory_analytic_dto.dart @@ -0,0 +1,146 @@ +part of '../analytic_dtos.dart'; + +@freezed +class InventoryAnalyticDto with _$InventoryAnalyticDto { + const InventoryAnalyticDto._(); + + const factory InventoryAnalyticDto({ + @JsonKey(name: "summary") InventoryAnalyticSummaryDto? summary, + @JsonKey(name: "products") List? products, + @JsonKey(name: "ingredients") + List? ingredients, + }) = _InventoryAnalyticDto; + + factory InventoryAnalyticDto.fromJson(Map json) => + _$InventoryAnalyticDtoFromJson(json); + + // Mapper ke domain (opsional) + InventoryAnalytic toDomain() => InventoryAnalytic( + summary: summary?.toDomain() ?? InventoryAnalyticSummary.empty(), + products: products?.map((e) => e.toDomain()).toList() ?? [], + ingredients: ingredients?.map((e) => e.toDomain()).toList() ?? [], + ); +} + +@freezed +class InventoryAnalyticSummaryDto with _$InventoryAnalyticSummaryDto { + const InventoryAnalyticSummaryDto._(); + + const factory InventoryAnalyticSummaryDto({ + @JsonKey(name: "total_products") int? totalProducts, + @JsonKey(name: "total_ingredients") int? totalIngredients, + @JsonKey(name: "total_value") int? totalValue, + @JsonKey(name: "low_stock_products") int? lowStockProducts, + @JsonKey(name: "low_stock_ingredients") int? lowStockIngredients, + @JsonKey(name: "zero_stock_products") int? zeroStockProducts, + @JsonKey(name: "zero_stock_ingredients") int? zeroStockIngredients, + @JsonKey(name: "total_sold_products") int? totalSoldProducts, + @JsonKey(name: "total_sold_ingredients") int? totalSoldIngredients, + @JsonKey(name: "outlet_id") String? outletId, + @JsonKey(name: "outlet_name") String? outletName, + @JsonKey(name: "generated_at") DateTime? generatedAt, + }) = _InventoryAnalyticSummaryDto; + + factory InventoryAnalyticSummaryDto.fromJson(Map json) => + _$InventoryAnalyticSummaryDtoFromJson(json); + + // Optional mapper ke entity + InventoryAnalyticSummary toDomain() => InventoryAnalyticSummary( + totalProducts: totalProducts ?? 0, + totalIngredients: totalIngredients ?? 0, + totalValue: totalValue ?? 0, + lowStockProducts: lowStockProducts ?? 0, + lowStockIngredients: lowStockIngredients ?? 0, + zeroStockProducts: zeroStockProducts ?? 0, + zeroStockIngredients: zeroStockIngredients ?? 0, + totalSoldProducts: totalSoldProducts ?? 0, + totalSoldIngredients: totalSoldIngredients ?? 0, + outletId: outletId ?? '', + outletName: outletName ?? '', + generatedAt: generatedAt ?? DateTime.now(), + ); +} + +@freezed +class InventoryAnalyticProductItemDto with _$InventoryAnalyticProductItemDto { + const InventoryAnalyticProductItemDto._(); + + const factory InventoryAnalyticProductItemDto({ + @JsonKey(name: "id") String? id, + @JsonKey(name: "product_id") String? productId, + @JsonKey(name: "product_name") String? productName, + @JsonKey(name: "category_name") String? categoryName, + @JsonKey(name: "quantity") int? quantity, + @JsonKey(name: "reorder_level") int? reorderLevel, + @JsonKey(name: "unit_cost") num? unitCost, + @JsonKey(name: "total_value") int? totalValue, + @JsonKey(name: "total_in") int? totalIn, + @JsonKey(name: "total_out") int? totalOut, + @JsonKey(name: "is_low_stock") bool? isLowStock, + @JsonKey(name: "is_zero_stock") bool? isZeroStock, + @JsonKey(name: "updated_at") DateTime? updatedAt, + }) = _InventoryAnalyticProductItemDto; + + factory InventoryAnalyticProductItemDto.fromJson(Map json) => + _$InventoryAnalyticProductItemDtoFromJson(json); + + // Mapper ke domain (opsional) + InventoryAnalyticProductItem toDomain() => InventoryAnalyticProductItem( + id: id ?? '', + productId: productId ?? '', + productName: productName ?? '', + categoryName: categoryName ?? '', + quantity: quantity ?? 0, + reorderLevel: reorderLevel ?? 0, + unitCost: unitCost ?? 0, + totalValue: totalValue ?? 0, + totalIn: totalIn ?? 0, + totalOut: totalOut ?? 0, + isLowStock: isLowStock ?? false, + isZeroStock: isZeroStock ?? false, + updatedAt: updatedAt ?? DateTime.now(), + ); +} + +@freezed +class InventoryAnalyticIngredientItemDto + with _$InventoryAnalyticIngredientItemDto { + const InventoryAnalyticIngredientItemDto._(); + + const factory InventoryAnalyticIngredientItemDto({ + @JsonKey(name: "id") String? id, + @JsonKey(name: "ingredient_id") String? ingredientId, + @JsonKey(name: "ingredient_name") String? ingredientName, + @JsonKey(name: "unit_name") String? unitName, + @JsonKey(name: "quantity") int? quantity, + @JsonKey(name: "reorder_level") int? reorderLevel, + @JsonKey(name: "unit_cost") num? unitCost, + @JsonKey(name: "total_value") int? totalValue, + @JsonKey(name: "total_in") int? totalIn, + @JsonKey(name: "total_out") int? totalOut, + @JsonKey(name: "is_low_stock") bool? isLowStock, + @JsonKey(name: "is_zero_stock") bool? isZeroStock, + @JsonKey(name: "updated_at") DateTime? updatedAt, + }) = _InventoryAnalyticIngredientItemDto; + + factory InventoryAnalyticIngredientItemDto.fromJson( + Map json, + ) => _$InventoryAnalyticIngredientItemDtoFromJson(json); + + // Mapper ke domain (opsional) + InventoryAnalyticIngredientItem toDomain() => InventoryAnalyticIngredientItem( + id: id ?? '', + ingredientId: ingredientId ?? '', + ingredientName: ingredientName ?? '', + unitName: unitName ?? '', + quantity: quantity ?? 0, + reorderLevel: reorderLevel ?? 0, + unitCost: unitCost ?? 0, + totalValue: totalValue ?? 0, + totalIn: totalIn ?? 0, + totalOut: totalOut ?? 0, + isLowStock: isLowStock ?? false, + isZeroStock: isZeroStock ?? false, + updatedAt: updatedAt ?? DateTime.now(), + ); +} diff --git a/lib/infrastructure/analytic/repositories/analytic_repository.dart b/lib/infrastructure/analytic/repositories/analytic_repository.dart index eba12d1..75b0b03 100644 --- a/lib/infrastructure/analytic/repositories/analytic_repository.dart +++ b/lib/infrastructure/analytic/repositories/analytic_repository.dart @@ -157,4 +157,28 @@ class AnalyticRepository implements IAnalyticRepository { return left(const AnalyticFailure.unexpectedError()); } } + + @override + Future> getInventory({ + required DateTime dateFrom, + required DateTime dateTo, + }) async { + try { + final result = await _dataProvider.fetchInventory( + dateFrom: dateFrom, + dateTo: dateTo, + ); + + if (result.hasError) { + return left(result.error!); + } + + final inventory = result.data!.toDomain(); + + return right(inventory); + } catch (e) { + log('getInventoryError', name: _logName, error: e); + return left(const AnalyticFailure.unexpectedError()); + } + } } diff --git a/lib/injection.config.dart b/lib/injection.config.dart index 1fa6ce2..25ae30a 100644 --- a/lib/injection.config.dart +++ b/lib/injection.config.dart @@ -13,6 +13,8 @@ import 'package:apskel_pos_flutter_v2/application/analytic/category_analytic_loa as _i911; import 'package:apskel_pos_flutter_v2/application/analytic/dashboard_analytic_loader/dashboard_analytic_loader_bloc.dart' as _i80; +import 'package:apskel_pos_flutter_v2/application/analytic/inventory_analytic_loader/inventory_analytic_loader_bloc.dart' + as _i651; import 'package:apskel_pos_flutter_v2/application/analytic/payment_method_analytic_loader/payment_method_analytic_loader_bloc.dart' as _i733; import 'package:apskel_pos_flutter_v2/application/analytic/product_analytic_loader/product_analytic_loader_bloc.dart' @@ -320,6 +322,9 @@ extension GetItInjectableX on _i174.GetIt { gh.factory<_i911.CategoryAnalyticLoaderBloc>( () => _i911.CategoryAnalyticLoaderBloc(gh<_i346.IAnalyticRepository>()), ); + gh.factory<_i651.InventoryAnalyticLoaderBloc>( + () => _i651.InventoryAnalyticLoaderBloc(gh<_i346.IAnalyticRepository>()), + ); return this; } } diff --git a/lib/presentation/pages/main/pages/report/report_page.dart b/lib/presentation/pages/main/pages/report/report_page.dart index 8f81b7d..3b86125 100644 --- a/lib/presentation/pages/main/pages/report/report_page.dart +++ b/lib/presentation/pages/main/pages/report/report_page.dart @@ -4,6 +4,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import '../../../../../application/analytic/category_analytic_loader/category_analytic_loader_bloc.dart'; import '../../../../../application/analytic/dashboard_analytic_loader/dashboard_analytic_loader_bloc.dart'; +import '../../../../../application/analytic/inventory_analytic_loader/inventory_analytic_loader_bloc.dart'; import '../../../../../application/analytic/payment_method_analytic_loader/payment_method_analytic_loader_bloc.dart'; import '../../../../../application/analytic/product_analytic_loader/product_analytic_loader_bloc.dart'; import '../../../../../application/analytic/profit_loss_analytic_loader/profit_loss_analytic_loader_bloc.dart'; @@ -19,6 +20,7 @@ import '../../../../components/spaces/space.dart'; import '../../../../router/app_router.gr.dart'; import 'sections/report_category_section.dart'; import 'sections/report_dashboard_section.dart'; +import 'sections/report_inventory_section.dart'; import 'sections/report_payment_method_section.dart'; import 'sections/report_product_section.dart'; import 'sections/report_profit_loss_section.dart'; @@ -185,7 +187,20 @@ class ReportPage extends StatelessWidget implements AutoRouteWrapper { ); }, ), - 6 => Text(state.title), + 6 => + BlocBuilder< + InventoryAnalyticLoaderBloc, + InventoryAnalyticLoaderState + >( + builder: (context, inventory) { + return ReportInventorySection( + menu: reportMenus[state.selectedMenu], + state: inventory, + startDate: state.startDate, + endDate: state.endDate, + ); + }, + ), 7 => BlocBuilder< CategoryAnalyticLoaderBloc, @@ -255,6 +270,12 @@ class ReportPage extends StatelessWidget implements AutoRouteWrapper { ), ); case 6: + return context.read().add( + InventoryAnalyticLoaderEvent.fetched( + startDate: state.startDate, + endDate: state.endDate, + ), + ); case 7: return context.read().add( CategoryAnalyticLoaderEvent.fetched( @@ -316,7 +337,6 @@ class ReportPage extends StatelessWidget implements AutoRouteWrapper { ), ), ), - BlocProvider( create: (context) => getIt() ..add( @@ -326,6 +346,15 @@ class ReportPage extends StatelessWidget implements AutoRouteWrapper { ), ), ), + BlocProvider( + create: (context) => getIt() + ..add( + InventoryAnalyticLoaderEvent.fetched( + startDate: DateTime.now().subtract(const Duration(days: 30)), + endDate: DateTime.now(), + ), + ), + ), ], child: this, ); diff --git a/lib/presentation/pages/main/pages/report/sections/report_inventory_section.dart b/lib/presentation/pages/main/pages/report/sections/report_inventory_section.dart new file mode 100644 index 0000000..acc4a16 --- /dev/null +++ b/lib/presentation/pages/main/pages/report/sections/report_inventory_section.dart @@ -0,0 +1,171 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; + +import '../../../../../../application/analytic/inventory_analytic_loader/inventory_analytic_loader_bloc.dart'; +import '../../../../../../common/data/report_menu.dart'; +import '../../../../../../common/extension/extension.dart'; +import '../../../../../../common/theme/theme.dart'; +import '../../../../../components/error/analytic_error_state_widget.dart'; +import '../../../../../components/loader/loader_with_text.dart'; +import '../../../../../components/spaces/space.dart'; +import '../../../../../components/widgets/report/report_header.dart'; +import '../../../../../components/widgets/report/report_summary_card.dart'; +import '../widgets/inventory/report_inventory_ingredient_tab.dart'; +import '../widgets/inventory/report_inventory_product_tab.dart'; + +class ReportInventorySection extends StatefulWidget { + final ReportMenu menu; + final InventoryAnalyticLoaderState state; + final DateTime startDate; + final DateTime endDate; + + const ReportInventorySection({ + super.key, + required this.menu, + required this.state, + required this.startDate, + required this.endDate, + }); + + @override + State createState() => _ReportInventorySectionState(); +} + +class _ReportInventorySectionState extends State { + int _selectedTabIndex = 0; + + @override + Widget build(BuildContext context) { + if (widget.state.isFetching) { + return const Center(child: LoaderWithText()); + } + return widget.state.failureOption.fold( + () => RefreshIndicator( + onRefresh: () { + context.read().add( + InventoryAnalyticLoaderEvent.fetched( + startDate: widget.startDate, + endDate: widget.endDate, + ), + ); + return Future.value(); + }, + child: ListView( + padding: EdgeInsets.all(16), + children: [ + ReportHeader( + menu: widget.menu, + endDate: widget.endDate, + startDate: widget.startDate, + ), + _buildSummary(), + Container( + padding: const EdgeInsets.only(top: 16), + child: Row( + children: [ + _buildTab('Produk', 0), + SpaceWidth(12), + _buildTab('Bahan Baku', 1), + ], + ), + ), + SpaceHeight(16), + + _selectedTabIndex == 0 + ? ReportInventoryProductTab( + data: widget.state.inventoryAnalytic, + ) + : ReportInventoryIngredientTab( + data: widget.state.inventoryAnalytic, + ), + ], + ), + ), + (f) => AnalyticErrorStateWidget( + failure: f, + menu: widget.menu, + onRefresh: () { + context.read().add( + InventoryAnalyticLoaderEvent.fetched( + startDate: widget.startDate, + endDate: widget.endDate, + ), + ); + }, + ), + ); + } + + Padding _buildSummary() { + return Padding( + padding: EdgeInsetsGeometry.only(top: 16), + child: Row( + children: [ + Expanded( + child: ReportSummaryCard( + color: AppColor.success, + icon: Icons.inventory_2_outlined, + title: 'Total Produk', + value: widget.state.inventoryAnalytic.summary.totalProducts + .toString(), + ), + ), + SpaceWidth(12), + Expanded( + child: ReportSummaryCard( + color: AppColor.info, + icon: Icons.list_alt_outlined, + title: 'Total Bahan', + value: widget.state.inventoryAnalytic.summary.totalIngredients + .toString(), + ), + ), + SpaceWidth(12), + Expanded( + child: ReportSummaryCard( + color: AppColor.primary, + icon: Icons.monetization_on_outlined, + title: 'Total Nilai', + value: widget + .state + .inventoryAnalytic + .summary + .totalValue + .currencyFormatRpV2, + ), + ), + ], + ), + ); + } + + Widget _buildTab(String title, int index) { + bool isActive = _selectedTabIndex == index; + return GestureDetector( + onTap: () { + setState(() { + _selectedTabIndex = index; + }); + }, + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10), + decoration: BoxDecoration( + color: isActive ? AppColor.primary : AppColor.white, + borderRadius: BorderRadius.circular(25), + border: Border.all( + color: isActive ? AppColor.primary : AppColor.border, + width: 1, + ), + ), + child: Text( + title, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: isActive ? AppColor.white : AppColor.textSecondary, + ), + ), + ), + ); + } +} diff --git a/lib/presentation/pages/main/pages/report/widgets/inventory/report_inventory_ingredient_tab.dart b/lib/presentation/pages/main/pages/report/widgets/inventory/report_inventory_ingredient_tab.dart new file mode 100644 index 0000000..671813b --- /dev/null +++ b/lib/presentation/pages/main/pages/report/widgets/inventory/report_inventory_ingredient_tab.dart @@ -0,0 +1,210 @@ +import 'package:flutter/material.dart'; + +import '../../../../../../../common/theme/theme.dart'; +import '../../../../../../../domain/analytic/analytic.dart'; +import '../../../../../../components/spaces/space.dart'; +import '../../../../../../components/widgets/report/report_summary_card.dart'; + +class ReportInventoryIngredientTab extends StatelessWidget { + final InventoryAnalytic data; + const ReportInventoryIngredientTab({super.key, required this.data}); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Row( + children: [ + Expanded( + child: ReportSummaryCard( + color: AppColor.success, + icon: Icons.warning_amber_outlined, + title: 'Low Stok', + value: data.summary.lowStockIngredients.toString(), + ), + ), + SpaceWidth(12), + Expanded( + child: ReportSummaryCard( + color: AppColor.error, + icon: Icons.block_outlined, + title: 'Zero Stok', + value: data.summary.zeroStockIngredients.toString(), + ), + ), + SpaceWidth(12), + Expanded( + child: ReportSummaryCard( + color: AppColor.error, + icon: Icons.shopping_cart_checkout_outlined, + title: 'Total Sold', + value: data.summary.totalSoldIngredients.toString(), + ), + ), + ], + ), + Container( + margin: EdgeInsets.only(top: 16), + decoration: BoxDecoration( + color: AppColor.primary, // Purple color + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + topRight: Radius.circular(8), + ), + ), + child: Table( + columnWidths: const { + 0: FlexColumnWidth(2.5), // Name + 1: FlexColumnWidth(1), // Stock + 2: FlexColumnWidth(2), // Masuk + 3: FlexColumnWidth(2), // Keluar + }, + children: [ + TableRow( + children: [ + _buildHeaderCell('Nama'), + _buildHeaderCell('Stock'), + _buildHeaderCell('Masuk'), + _buildHeaderCell('Keluar'), + ], + ), + ], + ), + ), + Container( + decoration: BoxDecoration(color: AppColor.white), + child: Table( + columnWidths: { + 0: FlexColumnWidth(2.5), // Name + 1: FlexColumnWidth(1), // Stock + 2: FlexColumnWidth(2), // Masuk + 3: FlexColumnWidth(2), // Keluar + }, + children: data.ingredients + .map( + (item) => _buildIngredientsDataRow( + item, + data.ingredients.indexOf(item) % 2 == 0, + ), + ) + .toList(), + ), + ), + Container( + decoration: BoxDecoration( + color: AppColor.primary, // Purple color + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(8), + bottomRight: Radius.circular(8), + ), + ), + child: Table( + columnWidths: const { + 0: FlexColumnWidth(2.5), // Name + 1: FlexColumnWidth(1), // Stock + 2: FlexColumnWidth(2), // Masuk + 3: FlexColumnWidth(2), // Keluar + }, + children: [ + TableRow( + children: [ + _buildTotalCell('TOTAL'), + _buildTotalCell( + (data.ingredients.fold( + 0, + (sum, item) => sum + (item.quantity), + )).toString(), + ), + _buildTotalCell( + (data.ingredients.fold( + 0, + (sum, item) => sum + (item.totalIn), + )).toString(), + ), + _buildTotalCell( + (data.ingredients.fold( + 0, + (sum, item) => sum + (item.totalOut), + )).toString(), + ), + ], + ), + ], + ), + ), + ], + ); + } + + TableRow _buildIngredientsDataRow( + InventoryAnalyticIngredientItem item, + bool isEven, + ) { + return TableRow( + decoration: BoxDecoration( + color: item.isZeroStock + ? Colors.red.shade100 + : item.isLowStock + ? Colors.yellow.shade100 + : isEven + ? Colors.grey.shade50 + : AppColor.white, + ), + children: [ + _buildDataCell(item.ingredientName, alignment: Alignment.centerLeft), + _buildDataCell(item.quantity.toString()), + _buildDataCell(item.totalIn.toString()), + _buildDataCell(item.totalOut.toString()), + ], + ); + } + + Widget _buildDataCell( + String text, { + Alignment alignment = Alignment.center, + Color? textColor, + }) { + return Container( + padding: EdgeInsets.symmetric(horizontal: 12, vertical: 16), + alignment: alignment, + child: Text( + text, + style: AppStyle.sm.copyWith( + color: textColor ?? AppColor.black, + fontWeight: FontWeight.normal, + ), + textAlign: alignment == Alignment.centerLeft + ? TextAlign.left + : TextAlign.center, + ), + ); + } + + Widget _buildHeaderCell(String text) { + return Container( + padding: EdgeInsets.symmetric(horizontal: 12, vertical: 16), + child: Text( + text, + style: AppStyle.sm.copyWith( + color: AppColor.white, + fontWeight: FontWeight.bold, + ), + textAlign: TextAlign.center, + ), + ); + } + + Widget _buildTotalCell(String text) { + return Container( + padding: EdgeInsets.symmetric(horizontal: 12, vertical: 16), + child: Text( + text, + style: AppStyle.sm.copyWith( + color: AppColor.white, + fontWeight: FontWeight.bold, + ), + textAlign: TextAlign.center, + ), + ); + } +} diff --git a/lib/presentation/pages/main/pages/report/widgets/inventory/report_inventory_product_tab.dart b/lib/presentation/pages/main/pages/report/widgets/inventory/report_inventory_product_tab.dart new file mode 100644 index 0000000..1fa677c --- /dev/null +++ b/lib/presentation/pages/main/pages/report/widgets/inventory/report_inventory_product_tab.dart @@ -0,0 +1,216 @@ +import 'package:flutter/material.dart'; + +import '../../../../../../../common/theme/theme.dart'; +import '../../../../../../../domain/analytic/analytic.dart'; +import '../../../../../../components/spaces/space.dart'; +import '../../../../../../components/widgets/report/report_summary_card.dart'; + +class ReportInventoryProductTab extends StatelessWidget { + final InventoryAnalytic data; + const ReportInventoryProductTab({super.key, required this.data}); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Row( + children: [ + Expanded( + child: ReportSummaryCard( + color: AppColor.success, + icon: Icons.warning_amber_outlined, + title: 'Low Stok', + value: data.summary.lowStockProducts.toString(), + ), + ), + SpaceWidth(12), + Expanded( + child: ReportSummaryCard( + color: AppColor.error, + icon: Icons.block_outlined, + title: 'Zero Stok', + value: data.summary.zeroStockProducts.toString(), + ), + ), + SpaceWidth(12), + Expanded( + child: ReportSummaryCard( + color: AppColor.error, + icon: Icons.shopping_cart_checkout_outlined, + title: 'Total Sold', + value: data.summary.totalSoldProducts.toString(), + ), + ), + ], + ), + Container( + margin: EdgeInsets.only(top: 16), + decoration: BoxDecoration( + color: AppColor.primary, // Purple color + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + topRight: Radius.circular(8), + ), + ), + child: Table( + columnWidths: const { + 0: FlexColumnWidth(2.5), // Produk + 1: FlexColumnWidth(2), // Kategori + 2: FlexColumnWidth(1), // Stock + 3: FlexColumnWidth(2), // Masuk + 4: FlexColumnWidth(2), // Keluar + }, + children: [ + TableRow( + children: [ + _buildHeaderCell('Nama'), + _buildHeaderCell('Kategori'), + _buildHeaderCell('Stock'), + _buildHeaderCell('Masuk'), + _buildHeaderCell('Keluar'), + ], + ), + ], + ), + ), + Container( + decoration: BoxDecoration(color: AppColor.white), + child: Table( + columnWidths: { + 0: FlexColumnWidth(2.5), // Produk + 1: FlexColumnWidth(2), // Kategori + 2: FlexColumnWidth(1), // Stock + 3: FlexColumnWidth(2), // Masuk + 4: FlexColumnWidth(2), // Keluar + }, + children: data.products + .map( + (item) => _buildProductDataRow( + item, + data.products.indexOf(item) % 2 == 0, + ), + ) + .toList(), + ), + ), + Container( + decoration: BoxDecoration( + color: AppColor.primary, // Purple color + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(8), + bottomRight: Radius.circular(8), + ), + ), + child: Table( + columnWidths: const { + 0: FlexColumnWidth(2.5), // Produk + 1: FlexColumnWidth(2), // Kategori + 2: FlexColumnWidth(1), // Stock + 3: FlexColumnWidth(2), // Masuk + 4: FlexColumnWidth(2), // Keluar + }, + children: [ + TableRow( + children: [ + _buildTotalCell('TOTAL'), + _buildTotalCell(''), + _buildTotalCell( + (data.products.fold( + 0, + (sum, item) => sum + (item.quantity), + )).toString(), + ), + _buildTotalCell( + (data.products.fold( + 0, + (sum, item) => sum + (item.totalIn), + )).toString(), + ), + _buildTotalCell( + (data.products.fold( + 0, + (sum, item) => sum + (item.totalOut), + )).toString(), + ), + ], + ), + ], + ), + ), + ], + ); + } + + TableRow _buildProductDataRow( + InventoryAnalyticProductItem product, + bool isEven, + ) { + return TableRow( + decoration: BoxDecoration( + color: product.isZeroStock + ? Colors.red.shade100 + : product.isLowStock + ? Colors.yellow.shade100 + : isEven + ? Colors.grey.shade50 + : AppColor.white, + ), + children: [ + _buildDataCell(product.productName, alignment: Alignment.centerLeft), + _buildDataCell(product.categoryName, alignment: Alignment.centerLeft), + _buildDataCell(product.quantity.toString()), + _buildDataCell(product.totalIn.toString()), + _buildDataCell(product.totalOut.toString()), + ], + ); + } + + Widget _buildDataCell( + String text, { + Alignment alignment = Alignment.center, + Color? textColor, + }) { + return Container( + padding: EdgeInsets.symmetric(horizontal: 12, vertical: 16), + alignment: alignment, + child: Text( + text, + style: AppStyle.sm.copyWith( + color: textColor ?? AppColor.black, + fontWeight: FontWeight.normal, + ), + textAlign: alignment == Alignment.centerLeft + ? TextAlign.left + : TextAlign.center, + ), + ); + } + + Widget _buildHeaderCell(String text) { + return Container( + padding: EdgeInsets.symmetric(horizontal: 12, vertical: 16), + child: Text( + text, + style: AppStyle.sm.copyWith( + color: AppColor.white, + fontWeight: FontWeight.bold, + ), + textAlign: TextAlign.center, + ), + ); + } + + Widget _buildTotalCell(String text) { + return Container( + padding: EdgeInsets.symmetric(horizontal: 12, vertical: 16), + child: Text( + text, + style: AppStyle.sm.copyWith( + color: AppColor.white, + fontWeight: FontWeight.bold, + ), + textAlign: TextAlign.center, + ), + ); + } +}