report payment method

This commit is contained in:
efrilm
2025-11-03 20:32:46 +07:00
parent 14c3c69ad6
commit 5a7892aa99
18 changed files with 2938 additions and 1 deletions
+1
View File
@@ -8,5 +8,6 @@ part 'analytic.freezed.dart';
part 'entities/dashboard_entity.dart';
part 'entities/sales_entity.dart';
part 'entities/product_analytic_entity.dart';
part 'entities/payment_method_analytic_entity.dart';
part 'failures/analytic_failure.dart';
part 'repositories/i_analytic_repository.dart';
+830
View File
@@ -3093,6 +3093,836 @@ abstract class _ProductAnalyticCategoryItem
get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$PaymentMethodAnalytic {
String get organizationId => throw _privateConstructorUsedError;
String get outletId => throw _privateConstructorUsedError;
DateTime get dateFrom => throw _privateConstructorUsedError;
DateTime get dateTo => throw _privateConstructorUsedError;
String get groupBy => throw _privateConstructorUsedError;
PaymentMethodAnalyticSummary get summary =>
throw _privateConstructorUsedError;
List<PaymentMethodAnalyticItem> get data =>
throw _privateConstructorUsedError;
/// Create a copy of PaymentMethodAnalytic
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$PaymentMethodAnalyticCopyWith<PaymentMethodAnalytic> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $PaymentMethodAnalyticCopyWith<$Res> {
factory $PaymentMethodAnalyticCopyWith(
PaymentMethodAnalytic value,
$Res Function(PaymentMethodAnalytic) then,
) = _$PaymentMethodAnalyticCopyWithImpl<$Res, PaymentMethodAnalytic>;
@useResult
$Res call({
String organizationId,
String outletId,
DateTime dateFrom,
DateTime dateTo,
String groupBy,
PaymentMethodAnalyticSummary summary,
List<PaymentMethodAnalyticItem> data,
});
$PaymentMethodAnalyticSummaryCopyWith<$Res> get summary;
}
/// @nodoc
class _$PaymentMethodAnalyticCopyWithImpl<
$Res,
$Val extends PaymentMethodAnalytic
>
implements $PaymentMethodAnalyticCopyWith<$Res> {
_$PaymentMethodAnalyticCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of PaymentMethodAnalytic
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? organizationId = null,
Object? outletId = null,
Object? dateFrom = null,
Object? dateTo = null,
Object? groupBy = null,
Object? summary = null,
Object? data = null,
}) {
return _then(
_value.copyWith(
organizationId: null == organizationId
? _value.organizationId
: organizationId // ignore: cast_nullable_to_non_nullable
as String,
outletId: null == outletId
? _value.outletId
: outletId // ignore: cast_nullable_to_non_nullable
as String,
dateFrom: null == dateFrom
? _value.dateFrom
: dateFrom // ignore: cast_nullable_to_non_nullable
as DateTime,
dateTo: null == dateTo
? _value.dateTo
: dateTo // ignore: cast_nullable_to_non_nullable
as DateTime,
groupBy: null == groupBy
? _value.groupBy
: groupBy // ignore: cast_nullable_to_non_nullable
as String,
summary: null == summary
? _value.summary
: summary // ignore: cast_nullable_to_non_nullable
as PaymentMethodAnalyticSummary,
data: null == data
? _value.data
: data // ignore: cast_nullable_to_non_nullable
as List<PaymentMethodAnalyticItem>,
)
as $Val,
);
}
/// Create a copy of PaymentMethodAnalytic
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$PaymentMethodAnalyticSummaryCopyWith<$Res> get summary {
return $PaymentMethodAnalyticSummaryCopyWith<$Res>(_value.summary, (value) {
return _then(_value.copyWith(summary: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$PaymentMethodAnalyticImplCopyWith<$Res>
implements $PaymentMethodAnalyticCopyWith<$Res> {
factory _$$PaymentMethodAnalyticImplCopyWith(
_$PaymentMethodAnalyticImpl value,
$Res Function(_$PaymentMethodAnalyticImpl) then,
) = __$$PaymentMethodAnalyticImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
String organizationId,
String outletId,
DateTime dateFrom,
DateTime dateTo,
String groupBy,
PaymentMethodAnalyticSummary summary,
List<PaymentMethodAnalyticItem> data,
});
@override
$PaymentMethodAnalyticSummaryCopyWith<$Res> get summary;
}
/// @nodoc
class __$$PaymentMethodAnalyticImplCopyWithImpl<$Res>
extends
_$PaymentMethodAnalyticCopyWithImpl<$Res, _$PaymentMethodAnalyticImpl>
implements _$$PaymentMethodAnalyticImplCopyWith<$Res> {
__$$PaymentMethodAnalyticImplCopyWithImpl(
_$PaymentMethodAnalyticImpl _value,
$Res Function(_$PaymentMethodAnalyticImpl) _then,
) : super(_value, _then);
/// Create a copy of PaymentMethodAnalytic
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? organizationId = null,
Object? outletId = null,
Object? dateFrom = null,
Object? dateTo = null,
Object? groupBy = null,
Object? summary = null,
Object? data = null,
}) {
return _then(
_$PaymentMethodAnalyticImpl(
organizationId: null == organizationId
? _value.organizationId
: organizationId // ignore: cast_nullable_to_non_nullable
as String,
outletId: null == outletId
? _value.outletId
: outletId // ignore: cast_nullable_to_non_nullable
as String,
dateFrom: null == dateFrom
? _value.dateFrom
: dateFrom // ignore: cast_nullable_to_non_nullable
as DateTime,
dateTo: null == dateTo
? _value.dateTo
: dateTo // ignore: cast_nullable_to_non_nullable
as DateTime,
groupBy: null == groupBy
? _value.groupBy
: groupBy // ignore: cast_nullable_to_non_nullable
as String,
summary: null == summary
? _value.summary
: summary // ignore: cast_nullable_to_non_nullable
as PaymentMethodAnalyticSummary,
data: null == data
? _value._data
: data // ignore: cast_nullable_to_non_nullable
as List<PaymentMethodAnalyticItem>,
),
);
}
}
/// @nodoc
class _$PaymentMethodAnalyticImpl implements _PaymentMethodAnalytic {
const _$PaymentMethodAnalyticImpl({
required this.organizationId,
required this.outletId,
required this.dateFrom,
required this.dateTo,
required this.groupBy,
required this.summary,
required final List<PaymentMethodAnalyticItem> data,
}) : _data = data;
@override
final String organizationId;
@override
final String outletId;
@override
final DateTime dateFrom;
@override
final DateTime dateTo;
@override
final String groupBy;
@override
final PaymentMethodAnalyticSummary summary;
final List<PaymentMethodAnalyticItem> _data;
@override
List<PaymentMethodAnalyticItem> get data {
if (_data is EqualUnmodifiableListView) return _data;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_data);
}
@override
String toString() {
return 'PaymentMethodAnalytic(organizationId: $organizationId, outletId: $outletId, dateFrom: $dateFrom, dateTo: $dateTo, groupBy: $groupBy, summary: $summary, data: $data)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PaymentMethodAnalyticImpl &&
(identical(other.organizationId, organizationId) ||
other.organizationId == organizationId) &&
(identical(other.outletId, outletId) ||
other.outletId == outletId) &&
(identical(other.dateFrom, dateFrom) ||
other.dateFrom == dateFrom) &&
(identical(other.dateTo, dateTo) || other.dateTo == dateTo) &&
(identical(other.groupBy, groupBy) || other.groupBy == groupBy) &&
(identical(other.summary, summary) || other.summary == summary) &&
const DeepCollectionEquality().equals(other._data, _data));
}
@override
int get hashCode => Object.hash(
runtimeType,
organizationId,
outletId,
dateFrom,
dateTo,
groupBy,
summary,
const DeepCollectionEquality().hash(_data),
);
/// Create a copy of PaymentMethodAnalytic
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$PaymentMethodAnalyticImplCopyWith<_$PaymentMethodAnalyticImpl>
get copyWith =>
__$$PaymentMethodAnalyticImplCopyWithImpl<_$PaymentMethodAnalyticImpl>(
this,
_$identity,
);
}
abstract class _PaymentMethodAnalytic implements PaymentMethodAnalytic {
const factory _PaymentMethodAnalytic({
required final String organizationId,
required final String outletId,
required final DateTime dateFrom,
required final DateTime dateTo,
required final String groupBy,
required final PaymentMethodAnalyticSummary summary,
required final List<PaymentMethodAnalyticItem> data,
}) = _$PaymentMethodAnalyticImpl;
@override
String get organizationId;
@override
String get outletId;
@override
DateTime get dateFrom;
@override
DateTime get dateTo;
@override
String get groupBy;
@override
PaymentMethodAnalyticSummary get summary;
@override
List<PaymentMethodAnalyticItem> get data;
/// Create a copy of PaymentMethodAnalytic
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$PaymentMethodAnalyticImplCopyWith<_$PaymentMethodAnalyticImpl>
get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$PaymentMethodAnalyticItem {
String get paymentMethodId => throw _privateConstructorUsedError;
String get paymentMethodName => throw _privateConstructorUsedError;
String get paymentMethodType => throw _privateConstructorUsedError;
int get totalAmount => throw _privateConstructorUsedError;
int get orderCount => throw _privateConstructorUsedError;
int get paymentCount => throw _privateConstructorUsedError;
num get percentage => throw _privateConstructorUsedError;
/// Create a copy of PaymentMethodAnalyticItem
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$PaymentMethodAnalyticItemCopyWith<PaymentMethodAnalyticItem> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $PaymentMethodAnalyticItemCopyWith<$Res> {
factory $PaymentMethodAnalyticItemCopyWith(
PaymentMethodAnalyticItem value,
$Res Function(PaymentMethodAnalyticItem) then,
) = _$PaymentMethodAnalyticItemCopyWithImpl<$Res, PaymentMethodAnalyticItem>;
@useResult
$Res call({
String paymentMethodId,
String paymentMethodName,
String paymentMethodType,
int totalAmount,
int orderCount,
int paymentCount,
num percentage,
});
}
/// @nodoc
class _$PaymentMethodAnalyticItemCopyWithImpl<
$Res,
$Val extends PaymentMethodAnalyticItem
>
implements $PaymentMethodAnalyticItemCopyWith<$Res> {
_$PaymentMethodAnalyticItemCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of PaymentMethodAnalyticItem
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? paymentMethodId = null,
Object? paymentMethodName = null,
Object? paymentMethodType = null,
Object? totalAmount = null,
Object? orderCount = null,
Object? paymentCount = null,
Object? percentage = null,
}) {
return _then(
_value.copyWith(
paymentMethodId: null == paymentMethodId
? _value.paymentMethodId
: paymentMethodId // ignore: cast_nullable_to_non_nullable
as String,
paymentMethodName: null == paymentMethodName
? _value.paymentMethodName
: paymentMethodName // ignore: cast_nullable_to_non_nullable
as String,
paymentMethodType: null == paymentMethodType
? _value.paymentMethodType
: paymentMethodType // ignore: cast_nullable_to_non_nullable
as String,
totalAmount: null == totalAmount
? _value.totalAmount
: totalAmount // ignore: cast_nullable_to_non_nullable
as int,
orderCount: null == orderCount
? _value.orderCount
: orderCount // ignore: cast_nullable_to_non_nullable
as int,
paymentCount: null == paymentCount
? _value.paymentCount
: paymentCount // ignore: cast_nullable_to_non_nullable
as int,
percentage: null == percentage
? _value.percentage
: percentage // ignore: cast_nullable_to_non_nullable
as num,
)
as $Val,
);
}
}
/// @nodoc
abstract class _$$PaymentMethodAnalyticItemImplCopyWith<$Res>
implements $PaymentMethodAnalyticItemCopyWith<$Res> {
factory _$$PaymentMethodAnalyticItemImplCopyWith(
_$PaymentMethodAnalyticItemImpl value,
$Res Function(_$PaymentMethodAnalyticItemImpl) then,
) = __$$PaymentMethodAnalyticItemImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
String paymentMethodId,
String paymentMethodName,
String paymentMethodType,
int totalAmount,
int orderCount,
int paymentCount,
num percentage,
});
}
/// @nodoc
class __$$PaymentMethodAnalyticItemImplCopyWithImpl<$Res>
extends
_$PaymentMethodAnalyticItemCopyWithImpl<
$Res,
_$PaymentMethodAnalyticItemImpl
>
implements _$$PaymentMethodAnalyticItemImplCopyWith<$Res> {
__$$PaymentMethodAnalyticItemImplCopyWithImpl(
_$PaymentMethodAnalyticItemImpl _value,
$Res Function(_$PaymentMethodAnalyticItemImpl) _then,
) : super(_value, _then);
/// Create a copy of PaymentMethodAnalyticItem
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? paymentMethodId = null,
Object? paymentMethodName = null,
Object? paymentMethodType = null,
Object? totalAmount = null,
Object? orderCount = null,
Object? paymentCount = null,
Object? percentage = null,
}) {
return _then(
_$PaymentMethodAnalyticItemImpl(
paymentMethodId: null == paymentMethodId
? _value.paymentMethodId
: paymentMethodId // ignore: cast_nullable_to_non_nullable
as String,
paymentMethodName: null == paymentMethodName
? _value.paymentMethodName
: paymentMethodName // ignore: cast_nullable_to_non_nullable
as String,
paymentMethodType: null == paymentMethodType
? _value.paymentMethodType
: paymentMethodType // ignore: cast_nullable_to_non_nullable
as String,
totalAmount: null == totalAmount
? _value.totalAmount
: totalAmount // ignore: cast_nullable_to_non_nullable
as int,
orderCount: null == orderCount
? _value.orderCount
: orderCount // ignore: cast_nullable_to_non_nullable
as int,
paymentCount: null == paymentCount
? _value.paymentCount
: paymentCount // ignore: cast_nullable_to_non_nullable
as int,
percentage: null == percentage
? _value.percentage
: percentage // ignore: cast_nullable_to_non_nullable
as num,
),
);
}
}
/// @nodoc
class _$PaymentMethodAnalyticItemImpl implements _PaymentMethodAnalyticItem {
const _$PaymentMethodAnalyticItemImpl({
required this.paymentMethodId,
required this.paymentMethodName,
required this.paymentMethodType,
required this.totalAmount,
required this.orderCount,
required this.paymentCount,
required this.percentage,
});
@override
final String paymentMethodId;
@override
final String paymentMethodName;
@override
final String paymentMethodType;
@override
final int totalAmount;
@override
final int orderCount;
@override
final int paymentCount;
@override
final num percentage;
@override
String toString() {
return 'PaymentMethodAnalyticItem(paymentMethodId: $paymentMethodId, paymentMethodName: $paymentMethodName, paymentMethodType: $paymentMethodType, totalAmount: $totalAmount, orderCount: $orderCount, paymentCount: $paymentCount, percentage: $percentage)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PaymentMethodAnalyticItemImpl &&
(identical(other.paymentMethodId, paymentMethodId) ||
other.paymentMethodId == paymentMethodId) &&
(identical(other.paymentMethodName, paymentMethodName) ||
other.paymentMethodName == paymentMethodName) &&
(identical(other.paymentMethodType, paymentMethodType) ||
other.paymentMethodType == paymentMethodType) &&
(identical(other.totalAmount, totalAmount) ||
other.totalAmount == totalAmount) &&
(identical(other.orderCount, orderCount) ||
other.orderCount == orderCount) &&
(identical(other.paymentCount, paymentCount) ||
other.paymentCount == paymentCount) &&
(identical(other.percentage, percentage) ||
other.percentage == percentage));
}
@override
int get hashCode => Object.hash(
runtimeType,
paymentMethodId,
paymentMethodName,
paymentMethodType,
totalAmount,
orderCount,
paymentCount,
percentage,
);
/// Create a copy of PaymentMethodAnalyticItem
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$PaymentMethodAnalyticItemImplCopyWith<_$PaymentMethodAnalyticItemImpl>
get copyWith =>
__$$PaymentMethodAnalyticItemImplCopyWithImpl<
_$PaymentMethodAnalyticItemImpl
>(this, _$identity);
}
abstract class _PaymentMethodAnalyticItem implements PaymentMethodAnalyticItem {
const factory _PaymentMethodAnalyticItem({
required final String paymentMethodId,
required final String paymentMethodName,
required final String paymentMethodType,
required final int totalAmount,
required final int orderCount,
required final int paymentCount,
required final num percentage,
}) = _$PaymentMethodAnalyticItemImpl;
@override
String get paymentMethodId;
@override
String get paymentMethodName;
@override
String get paymentMethodType;
@override
int get totalAmount;
@override
int get orderCount;
@override
int get paymentCount;
@override
num get percentage;
/// Create a copy of PaymentMethodAnalyticItem
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$PaymentMethodAnalyticItemImplCopyWith<_$PaymentMethodAnalyticItemImpl>
get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$PaymentMethodAnalyticSummary {
int get totalAmount => throw _privateConstructorUsedError;
int get totalOrders => throw _privateConstructorUsedError;
int get totalPayments => throw _privateConstructorUsedError;
double get averageOrderValue => throw _privateConstructorUsedError;
/// Create a copy of PaymentMethodAnalyticSummary
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$PaymentMethodAnalyticSummaryCopyWith<PaymentMethodAnalyticSummary>
get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $PaymentMethodAnalyticSummaryCopyWith<$Res> {
factory $PaymentMethodAnalyticSummaryCopyWith(
PaymentMethodAnalyticSummary value,
$Res Function(PaymentMethodAnalyticSummary) then,
) =
_$PaymentMethodAnalyticSummaryCopyWithImpl<
$Res,
PaymentMethodAnalyticSummary
>;
@useResult
$Res call({
int totalAmount,
int totalOrders,
int totalPayments,
double averageOrderValue,
});
}
/// @nodoc
class _$PaymentMethodAnalyticSummaryCopyWithImpl<
$Res,
$Val extends PaymentMethodAnalyticSummary
>
implements $PaymentMethodAnalyticSummaryCopyWith<$Res> {
_$PaymentMethodAnalyticSummaryCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of PaymentMethodAnalyticSummary
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? totalAmount = null,
Object? totalOrders = null,
Object? totalPayments = null,
Object? averageOrderValue = null,
}) {
return _then(
_value.copyWith(
totalAmount: null == totalAmount
? _value.totalAmount
: totalAmount // ignore: cast_nullable_to_non_nullable
as int,
totalOrders: null == totalOrders
? _value.totalOrders
: totalOrders // ignore: cast_nullable_to_non_nullable
as int,
totalPayments: null == totalPayments
? _value.totalPayments
: totalPayments // ignore: cast_nullable_to_non_nullable
as int,
averageOrderValue: null == averageOrderValue
? _value.averageOrderValue
: averageOrderValue // ignore: cast_nullable_to_non_nullable
as double,
)
as $Val,
);
}
}
/// @nodoc
abstract class _$$PaymentMethodAnalyticSummaryImplCopyWith<$Res>
implements $PaymentMethodAnalyticSummaryCopyWith<$Res> {
factory _$$PaymentMethodAnalyticSummaryImplCopyWith(
_$PaymentMethodAnalyticSummaryImpl value,
$Res Function(_$PaymentMethodAnalyticSummaryImpl) then,
) = __$$PaymentMethodAnalyticSummaryImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
int totalAmount,
int totalOrders,
int totalPayments,
double averageOrderValue,
});
}
/// @nodoc
class __$$PaymentMethodAnalyticSummaryImplCopyWithImpl<$Res>
extends
_$PaymentMethodAnalyticSummaryCopyWithImpl<
$Res,
_$PaymentMethodAnalyticSummaryImpl
>
implements _$$PaymentMethodAnalyticSummaryImplCopyWith<$Res> {
__$$PaymentMethodAnalyticSummaryImplCopyWithImpl(
_$PaymentMethodAnalyticSummaryImpl _value,
$Res Function(_$PaymentMethodAnalyticSummaryImpl) _then,
) : super(_value, _then);
/// Create a copy of PaymentMethodAnalyticSummary
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? totalAmount = null,
Object? totalOrders = null,
Object? totalPayments = null,
Object? averageOrderValue = null,
}) {
return _then(
_$PaymentMethodAnalyticSummaryImpl(
totalAmount: null == totalAmount
? _value.totalAmount
: totalAmount // ignore: cast_nullable_to_non_nullable
as int,
totalOrders: null == totalOrders
? _value.totalOrders
: totalOrders // ignore: cast_nullable_to_non_nullable
as int,
totalPayments: null == totalPayments
? _value.totalPayments
: totalPayments // ignore: cast_nullable_to_non_nullable
as int,
averageOrderValue: null == averageOrderValue
? _value.averageOrderValue
: averageOrderValue // ignore: cast_nullable_to_non_nullable
as double,
),
);
}
}
/// @nodoc
class _$PaymentMethodAnalyticSummaryImpl
implements _PaymentMethodAnalyticSummary {
const _$PaymentMethodAnalyticSummaryImpl({
required this.totalAmount,
required this.totalOrders,
required this.totalPayments,
required this.averageOrderValue,
});
@override
final int totalAmount;
@override
final int totalOrders;
@override
final int totalPayments;
@override
final double averageOrderValue;
@override
String toString() {
return 'PaymentMethodAnalyticSummary(totalAmount: $totalAmount, totalOrders: $totalOrders, totalPayments: $totalPayments, averageOrderValue: $averageOrderValue)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PaymentMethodAnalyticSummaryImpl &&
(identical(other.totalAmount, totalAmount) ||
other.totalAmount == totalAmount) &&
(identical(other.totalOrders, totalOrders) ||
other.totalOrders == totalOrders) &&
(identical(other.totalPayments, totalPayments) ||
other.totalPayments == totalPayments) &&
(identical(other.averageOrderValue, averageOrderValue) ||
other.averageOrderValue == averageOrderValue));
}
@override
int get hashCode => Object.hash(
runtimeType,
totalAmount,
totalOrders,
totalPayments,
averageOrderValue,
);
/// Create a copy of PaymentMethodAnalyticSummary
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$PaymentMethodAnalyticSummaryImplCopyWith<
_$PaymentMethodAnalyticSummaryImpl
>
get copyWith =>
__$$PaymentMethodAnalyticSummaryImplCopyWithImpl<
_$PaymentMethodAnalyticSummaryImpl
>(this, _$identity);
}
abstract class _PaymentMethodAnalyticSummary
implements PaymentMethodAnalyticSummary {
const factory _PaymentMethodAnalyticSummary({
required final int totalAmount,
required final int totalOrders,
required final int totalPayments,
required final double averageOrderValue,
}) = _$PaymentMethodAnalyticSummaryImpl;
@override
int get totalAmount;
@override
int get totalOrders;
@override
int get totalPayments;
@override
double get averageOrderValue;
/// Create a copy of PaymentMethodAnalyticSummary
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$PaymentMethodAnalyticSummaryImplCopyWith<
_$PaymentMethodAnalyticSummaryImpl
>
get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$AnalyticFailure {
@optionalTypeArgs
@@ -0,0 +1,65 @@
part of '../analytic.dart';
@freezed
class PaymentMethodAnalytic with _$PaymentMethodAnalytic {
const factory PaymentMethodAnalytic({
required String organizationId,
required String outletId,
required DateTime dateFrom,
required DateTime dateTo,
required String groupBy,
required PaymentMethodAnalyticSummary summary,
required List<PaymentMethodAnalyticItem> data,
}) = _PaymentMethodAnalytic;
factory PaymentMethodAnalytic.empty() => PaymentMethodAnalytic(
organizationId: '',
outletId: '',
dateFrom: DateTime.now(),
dateTo: DateTime.now(),
groupBy: '',
summary: PaymentMethodAnalyticSummary.empty(),
data: const [],
);
}
@freezed
class PaymentMethodAnalyticItem with _$PaymentMethodAnalyticItem {
const factory PaymentMethodAnalyticItem({
required String paymentMethodId,
required String paymentMethodName,
required String paymentMethodType,
required int totalAmount,
required int orderCount,
required int paymentCount,
required num percentage,
}) = _PaymentMethodAnalyticItem;
factory PaymentMethodAnalyticItem.empty() => const PaymentMethodAnalyticItem(
paymentMethodId: '',
paymentMethodName: '',
paymentMethodType: '',
totalAmount: 0,
orderCount: 0,
paymentCount: 0,
percentage: 0,
);
}
@freezed
class PaymentMethodAnalyticSummary with _$PaymentMethodAnalyticSummary {
const factory PaymentMethodAnalyticSummary({
required int totalAmount,
required int totalOrders,
required int totalPayments,
required double averageOrderValue,
}) = _PaymentMethodAnalyticSummary;
factory PaymentMethodAnalyticSummary.empty() =>
const PaymentMethodAnalyticSummary(
totalAmount: 0,
totalOrders: 0,
totalPayments: 0,
averageOrderValue: 0.0,
);
}
@@ -13,4 +13,8 @@ abstract class IAnalyticRepository {
required DateTime dateFrom,
required DateTime dateTo,
});
Future<Either<AnalyticFailure, PaymentMethodAnalytic>> getPaymentMethod({
required DateTime dateFrom,
required DateTime dateTo,
});
}