-- name: CreateNumericEntitlement :one
INSERT INTO core.numeric_entitlements (pool_id, resource_key, entitlement_type, resource_limit)
VALUES ($1, $2, $3, $4)
RETURNING *;

-- name: GetNumericEntitlementByPoolAndResource :one
SELECT * FROM core.numeric_entitlements
WHERE pool_id = $1 AND resource_key = $2;

-- name: UpdateNumericEntitlementLimit :one
UPDATE core.numeric_entitlements
SET resource_limit = $2
WHERE entitlement_id = $1
RETURNING *;

-- name: ListNumericEntitlementsByPoolID :many
SELECT * FROM core.numeric_entitlements
WHERE pool_id = $1
ORDER BY resource_key ASC;
