'use strict';

var pluginPermissionCommon = require('@backstage/plugin-permission-common');
var createConditionFactory = require('./createConditionFactory.cjs.js');

function createConditionExports(options) {
  const { rules } = options;
  const { pluginId, resourceType } = "resourceRef" in options ? options.resourceRef : options;
  return {
    conditions: Object.entries(rules).reduce(
      (acc, [key, rule]) => ({
        ...acc,
        [key]: createConditionFactory.createConditionFactory(rule)
      }),
      {}
    ),
    createConditionalDecision: (_permission, conditions) => ({
      result: pluginPermissionCommon.AuthorizeResult.CONDITIONAL,
      pluginId,
      resourceType,
      conditions
    })
  };
}

exports.createConditionExports = createConditionExports;
//# sourceMappingURL=createConditionExports.cjs.js.map
