import { importShared } from './__federation_fn_import-C3oBjoRC.js';

const RATE_LIMIT_MODELS = {
  /**
   * Model name for the rate limiter storage table used by rate-limiter-flexible.
   */
  rateLimiterFlexible: "RateLimiterFlexible"
};

const {FeatureUtils} = await importShared('@baseplate-dev/project-builder-lib');
function createRateLimitPartialDefinition(featureName) {
  return {
    features: FeatureUtils.createPartialFeatures(featureName),
    models: [
      {
        name: RATE_LIMIT_MODELS.rateLimiterFlexible,
        featureRef: featureName,
        model: {
          fields: [
            {
              name: "key",
              type: "string"
            },
            {
              name: "points",
              type: "int"
            },
            {
              name: "expire",
              type: "dateTime",
              isOptional: true
            }
          ],
          primaryKeyFieldRefs: ["key"]
        }
      }
    ]
  };
}

const {definitionSchema,featureEntityType} = await importShared('@baseplate-dev/project-builder-lib');

const {z} = await importShared('zod');

const createRateLimitPluginDefinitionSchema = definitionSchema(
  (ctx) => z.object({
    rateLimitFeatureRef: ctx.withRef({
      type: featureEntityType,
      onDelete: "RESTRICT"
    }),
    rateLimitOptions: z.object({}).prefault({})
  })
);

export { createRateLimitPartialDefinition as a, createRateLimitPluginDefinitionSchema as c };
//# sourceMappingURL=plugin-definition-D40BqcHC.js.map
