apskel-owner-flutter/lib/domain/analytic/entities/inventory_analytic_entity.dart
2025-08-17 23:54:28 +07:00

120 lines
2.9 KiB
Dart

part of '../analytic.dart';
@freezed
class InventoryAnalytic with _$InventoryAnalytic {
const factory InventoryAnalytic({
required InventorySummary summary,
required List<InventoryProduct> products,
required List<InventoryIngredient> ingredients,
}) = _InventoryAnalytic;
factory InventoryAnalytic.empty() => InventoryAnalytic(
summary: InventorySummary.empty(),
products: [],
ingredients: [],
);
}
@freezed
class InventorySummary with _$InventorySummary {
const factory InventorySummary({
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 String generatedAt,
}) = _InventorySummary;
factory InventorySummary.empty() => const InventorySummary(
totalProducts: 0,
totalIngredients: 0,
totalValue: 0,
lowStockProducts: 0,
lowStockIngredients: 0,
zeroStockProducts: 0,
zeroStockIngredients: 0,
totalSoldProducts: 0,
totalSoldIngredients: 0,
outletId: "",
outletName: "",
generatedAt: "",
);
}
@freezed
class InventoryProduct with _$InventoryProduct {
const factory InventoryProduct({
required String id,
required String productId,
required String productName,
required String categoryName,
required int quantity,
required int reorderLevel,
required int unitCost,
required int totalValue,
required int totalIn,
required int totalOut,
required bool isLowStock,
required bool isZeroStock,
required String updatedAt,
}) = _InventoryProduct;
factory InventoryProduct.empty() => const InventoryProduct(
id: "",
productId: "",
productName: "",
categoryName: "",
quantity: 0,
reorderLevel: 0,
unitCost: 0,
totalValue: 0,
totalIn: 0,
totalOut: 0,
isLowStock: false,
isZeroStock: false,
updatedAt: "",
);
}
@freezed
class InventoryIngredient with _$InventoryIngredient {
const factory InventoryIngredient({
required String id,
required String ingredientId,
required String ingredientName,
required String unitName,
required int quantity,
required int reorderLevel,
required int unitCost,
required int totalValue,
required int totalIn,
required int totalOut,
required bool isLowStock,
required bool isZeroStock,
required String updatedAt,
}) = _InventoryIngredient;
factory InventoryIngredient.empty() => const InventoryIngredient(
id: "",
ingredientId: "",
ingredientName: "",
unitName: "",
quantity: 0,
reorderLevel: 0,
unitCost: 0,
totalValue: 0,
totalIn: 0,
totalOut: 0,
isLowStock: false,
isZeroStock: false,
updatedAt: "",
);
}