import 'package:guru_app/financial/data/db/order_database.dart';
import 'package:guru_app/financial/product/product_model.dart';
import 'package:guru_app/inventory/db/inventory_database.dart';
import 'package:guru_app/inventory/inventory_manager.dart';
import 'package:guru_utils/datetime/datetime_utils.dart';
import 'package:guru_utils/id/id_utils.dart';
import 'package:guru_utils/manifest/manifest.dart';

// In-game barter Product
class IgbProduct implements Product {
  @override
  final ProductId productId;

  @override
  final Manifest manifest;

  final List<StockItem> cost;

  String get sku => productId.sku;

  IgbProduct(this.productId, this.manifest, this.cost);

  bool isConsumable() {
    return productId.isConsumable;
  }

  @override
  String toString() {
    return 'StockProduct{productId: $productId}';
  }

  @override
  OrderEntity createOrder() {
    return OrderEntity(
        orderId: IdUtils.uuidV4(),
        sku: productId.sku,
        state: TransactionState.success,
        attr: productId.attr,
        method: TransactionMethod.igc.index,
        currency: TransactionCurrency.igc,
        cost: 1,
        category: manifest.category,
        timestamp: DateTimeUtils.currentTimeInMillis(),
        manifest: manifest);
  }
}
