import { createPluginModelSyncChecker, FeatureUtils, PluginUtils, } from '@baseplate-dev/project-builder-lib';
import { createRateLimitPartialDefinition } from './models.js';
export function createRateLimitSchemaChecker(pluginKey) {
    return createPluginModelSyncChecker({
        pluginKey,
        pluginLabel: 'Rate Limit',
        buildPartialDef: (container) => {
            const pluginConfig = PluginUtils.configByKey(container.definition, pluginKey);
            const featureRef = pluginConfig?.rateLimitFeatureRef;
            if (!featureRef)
                return undefined;
            try {
                const featureName = FeatureUtils.getFeaturePathByIdOrThrow(container.definition, featureRef);
                return createRateLimitPartialDefinition(featureName);
            }
            catch {
                return undefined;
            }
        },
    });
}
//# sourceMappingURL=schema-issue-checker.js.map