feat: product analytic repo

This commit is contained in:
efrilm
2025-08-18 02:13:11 +07:00
parent b5593d10eb
commit d58198e7f0
17 changed files with 1845 additions and 1 deletions
@@ -6653,3 +6653,630 @@ abstract class _DashboardRecentSaleDto extends DashboardRecentSaleDto {
_$$DashboardRecentSaleDtoImplCopyWith<_$DashboardRecentSaleDtoImpl>
get copyWith => throw _privateConstructorUsedError;
}
ProductAnalyticDto _$ProductAnalyticDtoFromJson(Map<String, dynamic> json) {
return _ProductAnalyticDto.fromJson(json);
}
/// @nodoc
mixin _$ProductAnalyticDto {
@JsonKey(name: 'organization_id')
String get organizationId => throw _privateConstructorUsedError;
@JsonKey(name: 'outlet_id')
String get outletId => throw _privateConstructorUsedError;
@JsonKey(name: 'date_from')
String get dateFrom => throw _privateConstructorUsedError;
@JsonKey(name: 'date_to')
String get dateTo => throw _privateConstructorUsedError;
List<ProductAnalyticDataDto> get data => throw _privateConstructorUsedError;
/// Serializes this ProductAnalyticDto to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of ProductAnalyticDto
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ProductAnalyticDtoCopyWith<ProductAnalyticDto> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ProductAnalyticDtoCopyWith<$Res> {
factory $ProductAnalyticDtoCopyWith(
ProductAnalyticDto value,
$Res Function(ProductAnalyticDto) then,
) = _$ProductAnalyticDtoCopyWithImpl<$Res, ProductAnalyticDto>;
@useResult
$Res call({
@JsonKey(name: 'organization_id') String organizationId,
@JsonKey(name: 'outlet_id') String outletId,
@JsonKey(name: 'date_from') String dateFrom,
@JsonKey(name: 'date_to') String dateTo,
List<ProductAnalyticDataDto> data,
});
}
/// @nodoc
class _$ProductAnalyticDtoCopyWithImpl<$Res, $Val extends ProductAnalyticDto>
implements $ProductAnalyticDtoCopyWith<$Res> {
_$ProductAnalyticDtoCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ProductAnalyticDto
/// 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? 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 String,
dateTo: null == dateTo
? _value.dateTo
: dateTo // ignore: cast_nullable_to_non_nullable
as String,
data: null == data
? _value.data
: data // ignore: cast_nullable_to_non_nullable
as List<ProductAnalyticDataDto>,
)
as $Val,
);
}
}
/// @nodoc
abstract class _$$ProductAnalyticDtoImplCopyWith<$Res>
implements $ProductAnalyticDtoCopyWith<$Res> {
factory _$$ProductAnalyticDtoImplCopyWith(
_$ProductAnalyticDtoImpl value,
$Res Function(_$ProductAnalyticDtoImpl) then,
) = __$$ProductAnalyticDtoImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
@JsonKey(name: 'organization_id') String organizationId,
@JsonKey(name: 'outlet_id') String outletId,
@JsonKey(name: 'date_from') String dateFrom,
@JsonKey(name: 'date_to') String dateTo,
List<ProductAnalyticDataDto> data,
});
}
/// @nodoc
class __$$ProductAnalyticDtoImplCopyWithImpl<$Res>
extends _$ProductAnalyticDtoCopyWithImpl<$Res, _$ProductAnalyticDtoImpl>
implements _$$ProductAnalyticDtoImplCopyWith<$Res> {
__$$ProductAnalyticDtoImplCopyWithImpl(
_$ProductAnalyticDtoImpl _value,
$Res Function(_$ProductAnalyticDtoImpl) _then,
) : super(_value, _then);
/// Create a copy of ProductAnalyticDto
/// 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? data = null,
}) {
return _then(
_$ProductAnalyticDtoImpl(
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 String,
dateTo: null == dateTo
? _value.dateTo
: dateTo // ignore: cast_nullable_to_non_nullable
as String,
data: null == data
? _value._data
: data // ignore: cast_nullable_to_non_nullable
as List<ProductAnalyticDataDto>,
),
);
}
}
/// @nodoc
@JsonSerializable()
class _$ProductAnalyticDtoImpl extends _ProductAnalyticDto {
const _$ProductAnalyticDtoImpl({
@JsonKey(name: 'organization_id') required this.organizationId,
@JsonKey(name: 'outlet_id') required this.outletId,
@JsonKey(name: 'date_from') required this.dateFrom,
@JsonKey(name: 'date_to') required this.dateTo,
required final List<ProductAnalyticDataDto> data,
}) : _data = data,
super._();
factory _$ProductAnalyticDtoImpl.fromJson(Map<String, dynamic> json) =>
_$$ProductAnalyticDtoImplFromJson(json);
@override
@JsonKey(name: 'organization_id')
final String organizationId;
@override
@JsonKey(name: 'outlet_id')
final String outletId;
@override
@JsonKey(name: 'date_from')
final String dateFrom;
@override
@JsonKey(name: 'date_to')
final String dateTo;
final List<ProductAnalyticDataDto> _data;
@override
List<ProductAnalyticDataDto> get data {
if (_data is EqualUnmodifiableListView) return _data;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_data);
}
@override
String toString() {
return 'ProductAnalyticDto(organizationId: $organizationId, outletId: $outletId, dateFrom: $dateFrom, dateTo: $dateTo, data: $data)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ProductAnalyticDtoImpl &&
(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) &&
const DeepCollectionEquality().equals(other._data, _data));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
organizationId,
outletId,
dateFrom,
dateTo,
const DeepCollectionEquality().hash(_data),
);
/// Create a copy of ProductAnalyticDto
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ProductAnalyticDtoImplCopyWith<_$ProductAnalyticDtoImpl> get copyWith =>
__$$ProductAnalyticDtoImplCopyWithImpl<_$ProductAnalyticDtoImpl>(
this,
_$identity,
);
@override
Map<String, dynamic> toJson() {
return _$$ProductAnalyticDtoImplToJson(this);
}
}
abstract class _ProductAnalyticDto extends ProductAnalyticDto {
const factory _ProductAnalyticDto({
@JsonKey(name: 'organization_id') required final String organizationId,
@JsonKey(name: 'outlet_id') required final String outletId,
@JsonKey(name: 'date_from') required final String dateFrom,
@JsonKey(name: 'date_to') required final String dateTo,
required final List<ProductAnalyticDataDto> data,
}) = _$ProductAnalyticDtoImpl;
const _ProductAnalyticDto._() : super._();
factory _ProductAnalyticDto.fromJson(Map<String, dynamic> json) =
_$ProductAnalyticDtoImpl.fromJson;
@override
@JsonKey(name: 'organization_id')
String get organizationId;
@override
@JsonKey(name: 'outlet_id')
String get outletId;
@override
@JsonKey(name: 'date_from')
String get dateFrom;
@override
@JsonKey(name: 'date_to')
String get dateTo;
@override
List<ProductAnalyticDataDto> get data;
/// Create a copy of ProductAnalyticDto
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ProductAnalyticDtoImplCopyWith<_$ProductAnalyticDtoImpl> get copyWith =>
throw _privateConstructorUsedError;
}
ProductAnalyticDataDto _$ProductAnalyticDataDtoFromJson(
Map<String, dynamic> json,
) {
return _ProductAnalyticDataDto.fromJson(json);
}
/// @nodoc
mixin _$ProductAnalyticDataDto {
@JsonKey(name: 'product_id')
String get productId => throw _privateConstructorUsedError;
@JsonKey(name: 'product_name')
String get productName => throw _privateConstructorUsedError;
@JsonKey(name: 'category_id')
String get categoryId => throw _privateConstructorUsedError;
@JsonKey(name: 'category_name')
String get categoryName => throw _privateConstructorUsedError;
@JsonKey(name: 'quantity_sold')
int get quantitySold => throw _privateConstructorUsedError;
double get revenue => throw _privateConstructorUsedError;
@JsonKey(name: 'average_price')
double get averagePrice => throw _privateConstructorUsedError;
@JsonKey(name: 'order_count')
int get orderCount => throw _privateConstructorUsedError;
/// Serializes this ProductAnalyticDataDto to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of ProductAnalyticDataDto
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ProductAnalyticDataDtoCopyWith<ProductAnalyticDataDto> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ProductAnalyticDataDtoCopyWith<$Res> {
factory $ProductAnalyticDataDtoCopyWith(
ProductAnalyticDataDto value,
$Res Function(ProductAnalyticDataDto) then,
) = _$ProductAnalyticDataDtoCopyWithImpl<$Res, ProductAnalyticDataDto>;
@useResult
$Res call({
@JsonKey(name: 'product_id') String productId,
@JsonKey(name: 'product_name') String productName,
@JsonKey(name: 'category_id') String categoryId,
@JsonKey(name: 'category_name') String categoryName,
@JsonKey(name: 'quantity_sold') int quantitySold,
double revenue,
@JsonKey(name: 'average_price') double averagePrice,
@JsonKey(name: 'order_count') int orderCount,
});
}
/// @nodoc
class _$ProductAnalyticDataDtoCopyWithImpl<
$Res,
$Val extends ProductAnalyticDataDto
>
implements $ProductAnalyticDataDtoCopyWith<$Res> {
_$ProductAnalyticDataDtoCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ProductAnalyticDataDto
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? productId = null,
Object? productName = null,
Object? categoryId = null,
Object? categoryName = null,
Object? quantitySold = null,
Object? revenue = null,
Object? averagePrice = null,
Object? orderCount = null,
}) {
return _then(
_value.copyWith(
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,
categoryId: null == categoryId
? _value.categoryId
: categoryId // ignore: cast_nullable_to_non_nullable
as String,
categoryName: null == categoryName
? _value.categoryName
: categoryName // ignore: cast_nullable_to_non_nullable
as String,
quantitySold: null == quantitySold
? _value.quantitySold
: quantitySold // ignore: cast_nullable_to_non_nullable
as int,
revenue: null == revenue
? _value.revenue
: revenue // ignore: cast_nullable_to_non_nullable
as double,
averagePrice: null == averagePrice
? _value.averagePrice
: averagePrice // ignore: cast_nullable_to_non_nullable
as double,
orderCount: null == orderCount
? _value.orderCount
: orderCount // ignore: cast_nullable_to_non_nullable
as int,
)
as $Val,
);
}
}
/// @nodoc
abstract class _$$ProductAnalyticDataDtoImplCopyWith<$Res>
implements $ProductAnalyticDataDtoCopyWith<$Res> {
factory _$$ProductAnalyticDataDtoImplCopyWith(
_$ProductAnalyticDataDtoImpl value,
$Res Function(_$ProductAnalyticDataDtoImpl) then,
) = __$$ProductAnalyticDataDtoImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
@JsonKey(name: 'product_id') String productId,
@JsonKey(name: 'product_name') String productName,
@JsonKey(name: 'category_id') String categoryId,
@JsonKey(name: 'category_name') String categoryName,
@JsonKey(name: 'quantity_sold') int quantitySold,
double revenue,
@JsonKey(name: 'average_price') double averagePrice,
@JsonKey(name: 'order_count') int orderCount,
});
}
/// @nodoc
class __$$ProductAnalyticDataDtoImplCopyWithImpl<$Res>
extends
_$ProductAnalyticDataDtoCopyWithImpl<$Res, _$ProductAnalyticDataDtoImpl>
implements _$$ProductAnalyticDataDtoImplCopyWith<$Res> {
__$$ProductAnalyticDataDtoImplCopyWithImpl(
_$ProductAnalyticDataDtoImpl _value,
$Res Function(_$ProductAnalyticDataDtoImpl) _then,
) : super(_value, _then);
/// Create a copy of ProductAnalyticDataDto
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? productId = null,
Object? productName = null,
Object? categoryId = null,
Object? categoryName = null,
Object? quantitySold = null,
Object? revenue = null,
Object? averagePrice = null,
Object? orderCount = null,
}) {
return _then(
_$ProductAnalyticDataDtoImpl(
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,
categoryId: null == categoryId
? _value.categoryId
: categoryId // ignore: cast_nullable_to_non_nullable
as String,
categoryName: null == categoryName
? _value.categoryName
: categoryName // ignore: cast_nullable_to_non_nullable
as String,
quantitySold: null == quantitySold
? _value.quantitySold
: quantitySold // ignore: cast_nullable_to_non_nullable
as int,
revenue: null == revenue
? _value.revenue
: revenue // ignore: cast_nullable_to_non_nullable
as double,
averagePrice: null == averagePrice
? _value.averagePrice
: averagePrice // ignore: cast_nullable_to_non_nullable
as double,
orderCount: null == orderCount
? _value.orderCount
: orderCount // ignore: cast_nullable_to_non_nullable
as int,
),
);
}
}
/// @nodoc
@JsonSerializable()
class _$ProductAnalyticDataDtoImpl extends _ProductAnalyticDataDto {
const _$ProductAnalyticDataDtoImpl({
@JsonKey(name: 'product_id') required this.productId,
@JsonKey(name: 'product_name') required this.productName,
@JsonKey(name: 'category_id') required this.categoryId,
@JsonKey(name: 'category_name') required this.categoryName,
@JsonKey(name: 'quantity_sold') required this.quantitySold,
required this.revenue,
@JsonKey(name: 'average_price') required this.averagePrice,
@JsonKey(name: 'order_count') required this.orderCount,
}) : super._();
factory _$ProductAnalyticDataDtoImpl.fromJson(Map<String, dynamic> json) =>
_$$ProductAnalyticDataDtoImplFromJson(json);
@override
@JsonKey(name: 'product_id')
final String productId;
@override
@JsonKey(name: 'product_name')
final String productName;
@override
@JsonKey(name: 'category_id')
final String categoryId;
@override
@JsonKey(name: 'category_name')
final String categoryName;
@override
@JsonKey(name: 'quantity_sold')
final int quantitySold;
@override
final double revenue;
@override
@JsonKey(name: 'average_price')
final double averagePrice;
@override
@JsonKey(name: 'order_count')
final int orderCount;
@override
String toString() {
return 'ProductAnalyticDataDto(productId: $productId, productName: $productName, categoryId: $categoryId, categoryName: $categoryName, quantitySold: $quantitySold, revenue: $revenue, averagePrice: $averagePrice, orderCount: $orderCount)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ProductAnalyticDataDtoImpl &&
(identical(other.productId, productId) ||
other.productId == productId) &&
(identical(other.productName, productName) ||
other.productName == productName) &&
(identical(other.categoryId, categoryId) ||
other.categoryId == categoryId) &&
(identical(other.categoryName, categoryName) ||
other.categoryName == categoryName) &&
(identical(other.quantitySold, quantitySold) ||
other.quantitySold == quantitySold) &&
(identical(other.revenue, revenue) || other.revenue == revenue) &&
(identical(other.averagePrice, averagePrice) ||
other.averagePrice == averagePrice) &&
(identical(other.orderCount, orderCount) ||
other.orderCount == orderCount));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
productId,
productName,
categoryId,
categoryName,
quantitySold,
revenue,
averagePrice,
orderCount,
);
/// Create a copy of ProductAnalyticDataDto
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ProductAnalyticDataDtoImplCopyWith<_$ProductAnalyticDataDtoImpl>
get copyWith =>
__$$ProductAnalyticDataDtoImplCopyWithImpl<_$ProductAnalyticDataDtoImpl>(
this,
_$identity,
);
@override
Map<String, dynamic> toJson() {
return _$$ProductAnalyticDataDtoImplToJson(this);
}
}
abstract class _ProductAnalyticDataDto extends ProductAnalyticDataDto {
const factory _ProductAnalyticDataDto({
@JsonKey(name: 'product_id') required final String productId,
@JsonKey(name: 'product_name') required final String productName,
@JsonKey(name: 'category_id') required final String categoryId,
@JsonKey(name: 'category_name') required final String categoryName,
@JsonKey(name: 'quantity_sold') required final int quantitySold,
required final double revenue,
@JsonKey(name: 'average_price') required final double averagePrice,
@JsonKey(name: 'order_count') required final int orderCount,
}) = _$ProductAnalyticDataDtoImpl;
const _ProductAnalyticDataDto._() : super._();
factory _ProductAnalyticDataDto.fromJson(Map<String, dynamic> json) =
_$ProductAnalyticDataDtoImpl.fromJson;
@override
@JsonKey(name: 'product_id')
String get productId;
@override
@JsonKey(name: 'product_name')
String get productName;
@override
@JsonKey(name: 'category_id')
String get categoryId;
@override
@JsonKey(name: 'category_name')
String get categoryName;
@override
@JsonKey(name: 'quantity_sold')
int get quantitySold;
@override
double get revenue;
@override
@JsonKey(name: 'average_price')
double get averagePrice;
@override
@JsonKey(name: 'order_count')
int get orderCount;
/// Create a copy of ProductAnalyticDataDto
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ProductAnalyticDataDtoImplCopyWith<_$ProductAnalyticDataDtoImpl>
get copyWith => throw _privateConstructorUsedError;
}