part of '../analytic.dart';

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

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

@freezed
class ProductAnalyticData with _$ProductAnalyticData {
  const factory ProductAnalyticData({
    required String productId,
    required String productName,
    required String productSku,
    required int productPrice,
    required String categoryId,
    required String categoryName,
    required int categoryOrder,
    required int quantitySold,
    required int revenue,
    required double averagePrice,
    required int orderCount,
    required int standardHppPerUnit,
    required int standardHppTotal,
    required int fifoHppPerUnit,
    required int fifoHppTotal,
    required int movingAverageHppPerUnit,
    required int movingAverageHppTotal,
  }) = _ProductAnalyticData;

  factory ProductAnalyticData.empty() => const ProductAnalyticData(
    productId: '',
    productName: '',
    productSku: '',
    productPrice: 0,
    categoryId: '',
    categoryName: '',
    categoryOrder: 0,
    quantitySold: 0,
    revenue: 0,
    averagePrice: 0.0,
    orderCount: 0,
    standardHppPerUnit: 0,
    standardHppTotal: 0,
    fifoHppPerUnit: 0,
    fifoHppTotal: 0,
    movingAverageHppPerUnit: 0,
    movingAverageHppTotal: 0,
  );
}
