import { importShared } from './__federation_fn_import-B0FfK6vm.js';
import { C as CASE_VALIDATORS } from './case-validators-CdzBcsFy.js';

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

const storageAdapterEntityType = createEntityType(
  "plugin-storage/storage-adapter"
);
const fileCategoryEntityType = createEntityType(
  "plugin-storage/file-category"
);
const createFileCategorySchema = definitionSchema(
  (ctx) => ctx.withEnt(
    z.object({
      id: z.string(),
      name: CASE_VALIDATORS.CONSTANT_CASE,
      maxFileSizeMb: z.int().positive(),
      authorize: z.object({
        uploadRoles: z.array(
          ctx.withRef({
            type: authRoleEntityType,
            onDelete: "RESTRICT"
          })
        )
      }),
      adapterRef: ctx.withRef({
        type: storageAdapterEntityType,
        onDelete: "RESTRICT"
      }),
      disableAutoCleanup: z.boolean().optional()
    }),
    { type: fileCategoryEntityType }
  )
);
const createStoragePluginDefinitionSchema = definitionSchema(
  (ctx) => z.object({
    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 }
      )
    ),
    fileCategories: z.array(createFileCategorySchema(ctx)).default([])
  })
);

export { createStoragePluginDefinitionSchema as a, createFileCategorySchema as c, fileCategoryEntityType as f, storageAdapterEntityType as s };
//# sourceMappingURL=plugin-definition-OkLTrrL5.js.map
