import { getPolicyResponseCode } from "./getPolicyResponseCode";
/**
 * @internal
 * Verify that the policy.environment requirement is met.
 *
 * @param policy
 * @param context
 * @param entity
 * @returns
 */
export function checkEnvironment(policy, context, _entity) {
    const checks = [];
    if (policy.environments && policy.environments.length) {
        let result = "granted";
        if (!policy.environments.includes(context.environment)) {
            result = "not-in-environment";
        }
        const check = {
            name: `user in ${policy.environments.join(",")} org`,
            value: context.environment,
            code: getPolicyResponseCode(result),
            response: result,
        };
        checks.push(check);
    }
    return checks;
}
//# sourceMappingURL=checkEnvironment.js.map