import { importShared } from './__federation_fn_import-BBEx2jc4.js';
import { s as storageAdapterEntityType } from './plugin-definition-BODH3hW9.js';
import { C as CASE_VALIDATORS } from './case-validators-HOo6y4I0.js';

const {authRoleEntityType,baseTransformerFields,createDefinitionEntityNameResolver,definitionSchema,modelLocalRelationEntityType,modelTransformerEntityType} = await importShared('@baseplate-dev/project-builder-lib');
const {z} = await importShared('zod');
const createFileTransformerSchema = definitionSchema(
  (ctx) => ctx.withEnt(
    z.object({
      ...baseTransformerFields,
      fileRelationRef: ctx.withRef({
        type: modelLocalRelationEntityType,
        onDelete: "DELETE_PARENT",
        parentPath: { context: "model" }
      }),
      category: z.object({
        name: CASE_VALIDATORS.CONSTANT_CASE,
        maxFileSizeMb: z.number().int().positive(),
        authorize: z.object({
          uploadRoles: z.array(
            ctx.withRef({
              type: authRoleEntityType,
              onDelete: "RESTRICT"
            })
          )
        }),
        adapterRef: ctx.withRef({
          type: storageAdapterEntityType,
          onDelete: "RESTRICT"
        })
      }),
      type: z.literal("file")
    }),
    {
      type: modelTransformerEntityType,
      parentPath: { context: "model" },
      getNameResolver: (entity) => createDefinitionEntityNameResolver({
        idsToResolve: { fileRelation: entity.fileRelationRef },
        resolveName: (entityNames) => entityNames.fileRelation
      })
    }
  )
);

const {createPlatformPluginExport,modelTransformerSpec} = await importShared('@baseplate-dev/project-builder-lib');
const common = createPlatformPluginExport({
  dependencies: {
    transformer: modelTransformerSpec
  },
  exports: {},
  initialize: ({ transformer }) => {
    transformer.registerModelTransformer({
      name: "file",
      createSchema: createFileTransformerSchema,
      getName(definitionContainer, definition) {
        return definitionContainer.nameFromId(definition.fileRelationRef);
      }
    });
    return {};
  }
});

export { common as default };
//# sourceMappingURL=__federation_expose_storageTransformersCommon-Dx_oZCdw.js.map
