part of '../analytic.dart';

@freezed
class ProductAnalytic with _$ProductAnalytic {
  const factory ProductAnalytic({
    required String organizationId,
    required String outletId,
    required String dateFrom,
    required String dateTo,
    required List<ProductAnalyticData> data,
  }) = _ProductAnalytic;

  factory ProductAnalytic.empty() => const ProductAnalytic(
    organizationId: '',
    outletId: '',
    dateFrom: '',
    dateTo: '',
    data: [],
  );
}

@freezed
class ProductAnalyticData with _$ProductAnalyticData {
  const factory ProductAnalyticData({
    required String productId,
    required String productName,
    required String categoryId,
    required String categoryName,
    required int quantitySold,
    required double revenue,
    required double averagePrice,
    required int orderCount,
  }) = _ProductAnalyticData;

  factory ProductAnalyticData.empty() => const ProductAnalyticData(
    productId: '',
    productName: '',
    categoryId: '',
    categoryName: '',
    quantitySold: 0,
    revenue: 0.0,
    averagePrice: 0.0,
    orderCount: 0,
  );
}
