Files
cfw-autumn/shared/utils/usageWindowUtils/classifyUsageWindow/usageWindowMatchesLimit.ts
2026-06-11 15:28:59 +01:00

17 lines
609 B
TypeScript

import type { UsageWindowLimit } from "../../../models/cusProductModels/cusEntModels/usageWindowModels.js";
import type { UsageWindow } from "../../../models/cusProductModels/cusEntModels/usageWindowTable.js";
/**
* Whether a counter row and a resolved limit describe the same counter:
* same feature, same scope (null entity = customer scope).
*/
export const usageWindowMatchesLimit = ({
usageWindow,
limit,
}: {
usageWindow: UsageWindow;
limit: UsageWindowLimit;
}): boolean =>
usageWindow.feature_id === limit.feature_id &&
(usageWindow.internal_entity_id ?? null) === limit.internal_entity_id;