import { adminCrudActionCompilerSpec, adminCrudColumnCompilerSpec, authConfigSpec, createPlatformPluginExport, } from '@baseplate-dev/project-builder-lib';
import { adminCrudManageRolesActionGenerator } from './generators/admin-crud-manage-roles-action/index.js';
import { adminCrudResetPasswordActionGenerator } from './generators/admin-crud-reset-password-action/index.js';
import { adminCrudRolesColumnGenerator } from './generators/admin-crud-roles-column/index.js';
function buildRolesColumnCompiler() {
    return {
        name: 'roles',
        compileColumn(definition, { order }) {
            return adminCrudRolesColumnGenerator({
                id: definition.id,
                label: definition.label,
                order,
            });
        },
    };
}
function buildManageRolesActionCompiler(authConfig) {
    return {
        name: 'manage-roles',
        compileAction(definition, { order, definitionContainer }) {
            return adminCrudManageRolesActionGenerator({
                order,
                position: definition.position,
                availableRoles: authConfig
                    .getAuthRoles(definitionContainer.definition)
                    .filter((r) => !r.builtIn),
            });
        },
    };
}
function buildResetPasswordActionCompiler() {
    return {
        name: 'reset-password',
        compileAction(definition, { order }) {
            return adminCrudResetPasswordActionGenerator({
                order,
                position: definition.position,
            });
        },
    };
}
export default createPlatformPluginExport({
    dependencies: {
        adminCrudActionCompiler: adminCrudActionCompilerSpec,
        adminCrudColumnCompiler: adminCrudColumnCompilerSpec,
        authConfig: authConfigSpec,
    },
    exports: {},
    initialize: ({ adminCrudActionCompiler, authConfig, adminCrudColumnCompiler, }) => {
        adminCrudActionCompiler.registerCompiler(buildManageRolesActionCompiler(authConfig));
        adminCrudActionCompiler.registerCompiler(buildResetPasswordActionCompiler());
        adminCrudColumnCompiler.registerCompiler(buildRolesColumnCompiler());
        return {};
    },
});
//# sourceMappingURL=node.js.map