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

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

const z = await importShared('zod');

const storageAdapterEntityType = createEntityType(
  "plugin-storage/storage-adapter"
);
const createStoragePluginDefinitionSchema = definitionSchema(
  (ctx) => ctx.withRefBuilder(
    z.object({
      modelRefs: z.object({
        file: ctx.withRef({
          type: modelEntityType,
          onDelete: "RESTRICT"
        })
      }),
      storageFeatureRef: ctx.withRef({
        type: featureEntityType,
        onDelete: "RESTRICT"
      }),
      s3Adapters: z.array(
        ctx.withEnt(
          z.object({
            id: z.string(),
            name: VALIDATORS.CAMEL_CASE_STRING,
            bucketConfigVar: VALIDATORS.CONSTANT_CASE_STRING,
            hostedUrlConfigVar: VALIDATORS.OPTIONAL_CONSTANT_CASE_STRING
          }),
          { type: storageAdapterEntityType }
        )
      )
    }),
    (builder) => {
      builder.addPathToContext("modelRefs.file", modelEntityType, "fileModel");
    }
  )
);

export { createStoragePluginDefinitionSchema as c, storageAdapterEntityType as s };
//# sourceMappingURL=plugin-definition-BODH3hW9.js.map
