using Indotalent.Data.Entities;
using Indotalent.Shared.Utils;

namespace Indotalent.Infrastructure.Database;

public static class AppDbContextExtensions
{
    public static void CalculateInvenTrans(this AppDbContext context, InventoryTransaction transaction)
    {
        InventoryTransactionHelper.CalculateInvenTrans(context, transaction);
    }
    public static double GetStock(this AppDbContext context, string? warehouseId, string? productId, string? currentId = null)
    {
        return InventoryTransactionHelper.GetStock(context, warehouseId, productId, currentId);
    }
    public static void RecalculatePurchaseOrder(this AppDbContext context, string purchaseOrderId)
    {
        PurchaseOrderHelper.Recalculate(context, purchaseOrderId);
    }
    public static void RecalculatePurchaseRequisition(this AppDbContext context, string requisitionId)
    {
        PurchaseRequisitionHelper.Recalculate(context, requisitionId);
    }
    public static void RecalculateSalesOrder(this AppDbContext context, string salesOrderId)
    {
        SalesOrderHelper.Recalculate(context, salesOrderId);
    }
    public static void RecalculateSalesQuotation(this AppDbContext context, string quotationId)
    {
        SalesQuotationHelper.Recalculate(context, quotationId);
    }
}
